bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

command -v should be quiet, -V absolute and both ignore non-executable f


From: llattanzi+bash
Subject: command -v should be quiet, -V absolute and both ignore non-executable files
Date: Thu, 29 Jul 2004 15:55:33 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin8.0
Compiler: gcc
Compilation CFLAGS: -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' -DCONF_OSTYPE='darwin8.0' -DCONF_MACHTYPE='powerpc-apple-darwin8.0' -DCONF_VENDOR='apple' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I. -I/SourceCache/bash/bash-35/bash -I/SourceCache/bash/bash-35/bash/include -I/SourceCache/bash/bash-35/bash/lib -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe uname output: Darwin stderr.apple.com 8.0.0b1 Darwin Kernel Version 8.0.0b1: Wed Jul 21 17:57:51 PDT 2004; root:xnu/xnu-645.1.obj~1/RELEASE_PPC Power Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        See below

Repeat-By:
        PATH=.:$PATH
        touch foo
        chmod 0 foo
        command -v foo #should be no output
        touch bar
        chmod +x bar
        command -V bar #should print $PWD/bar
        command -v I_dont_exist #should also be quiet
        

Fix:
Index: bash/bash/builtins/command.def
diff -c bash/bash/builtins/command.def:1.1.1.4 bash/bash/builtins/command.def:1.1.1.4.50.1
*** bash/bash/builtins/command.def:1.1.1.4      Sat Apr  5 00:00:27 2003
--- bash/bash/builtins/command.def      Thu Jul 29 15:51:27 2004
***************
*** 54,59 ****
--- 54,60 ----
  #endif

  extern int subshell_environment;
+ extern int posixly_correct;

  static void restore_path __P((char *));
  static char *get_standard_path __P((void));
***************
*** 101,107 ****
        {
          found = describe_command (list->word->word, verbose);

!         if (found == 0)
            sh_notfound (list->word->word);

          any_found += found;
--- 102,108 ----
        {
          found = describe_command (list->word->word, verbose);

!         if (found == 0 && posixly_correct && verbose != CDESC_REUSABLE)
            sh_notfound (list->word->word);

          any_found += found;
Index: bash/bash/builtins/type.def
diff -c bash/bash/builtins/type.def:1.1.1.5 bash/bash/builtins/type.def:1.1.1.5.50.1
*** bash/bash/builtins/type.def:1.1.1.5 Sat Apr  5 00:00:28 2003
--- bash/bash/builtins/type.def Thu Jul 29 15:51:27 2004
***************
*** 73,78 ****
--- 73,79 ----
  extern int find_reserved_word __P((char *));

  extern char *this_command_name;
+ extern int posixly_correct;

  /* For each word in LIST, find out what the shell is going to do with
     it as a simple command. i.e., which file would this shell use to
***************
*** 358,364 ****
/* If we found the command as itself by looking through $PATH, it
         probably doesn't exist.  Check whether or not the command is an
         executable file.  If it's not, don't report a match. */
!       if (STREQ (full_path, command))
        {
          f = file_status (full_path);
          if ((f & FS_EXECABLE) == 0)
--- 359,365 ----
/* If we found the command as itself by looking through $PATH, it
         probably doesn't exist.  Check whether or not the command is an
         executable file.  If it's not, don't report a match. */
!       if (STREQ (full_path, command) || posixly_correct)
        {
          f = file_status (full_path);
          if ((f & FS_EXECABLE) == 0)
***************
*** 367,375 ****
              full_path = (char *)NULL;
              if (all == 0)
                break;
!           }
!         else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY|CDESC_SHORTDESC))
!           full_path = sh_makepath ((char *)NULL, full_path, MP_DOCWD);
        }

        found_file++;
--- 368,378 ----
              full_path = (char *)NULL;
              if (all == 0)
                break;
!           }
!           /* command -V must emit an absolute path for POSIX  */
!         else if ((STREQ (full_path, command) || !ABSPATH(full_path)) &&
!                  (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY|CDESC_SHORTDESC)))
! full_path = sh_makepath ((char *)NULL, full_path, MP_DOCWD|MP_RMDOT);
        }

        found_file++;

        fix for the problem, don't include this section.]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]