[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
type should not report matches on non-executable files
From: |
llattanzi+bash |
Subject: |
type should not report matches on non-executable files |
Date: |
Mon, 19 Jul 2004 12:07:24 -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-32/bash
-I/SourceCache/bash/bash-32/bash/include
-I/SourceCache/bash/bash-32/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: Mon Jul 12 21:41:56 PDT 2004;
root:xnu/xnu-638.1.obj~4/RELEASE_PPC Power Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
If the path to a command doesn't have execute permission, then type
should ignore it
Repeat-By:
PATH=$PATH:.
touch foo
chmod 0 foo
type foo
Fix:
Index: bash/bash/builtins/type.def
diff -u bash/bash/builtins/type.def:1.1.1.5
bash/bash/builtins/type.def:1.1.1.5.46.1
--- bash/bash/builtins/type.def:1.1.1.5 Sat Apr 5 00:00:28 2003
+++ bash/bash/builtins/type.def Mon Jul 19 12:07:33 2004
@@ -73,6 +73,7 @@
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,7 +359,8 @@
/* 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))
+ /* Don't report paths that would fail execution when
posixly_correct */
+ if (STREQ (full_path, command) || posixly_correct)
{
f = file_status (full_path);
if ((f & FS_EXECABLE) == 0)
@@ -368,7 +370,7 @@
if (all == 0)
break;
}
- else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY|CDESC_SHORTDESC))
+ else if (!posixly_correct && (dflags &
(CDESC_REUSABLE|CDESC_PATH_ONLY|CDESC_SHORTDESC)))
full_path = sh_makepath ((char *)NULL, full_path, MP_DOCWD);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- type should not report matches on non-executable files,
llattanzi+bash <=