bug-bash
[Top][All Lists]
Advanced

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

[Patch-ID: bash204-007] I think this patch is wrong.


From: Karl M. Hegbloom
Subject: [Patch-ID: bash204-007] I think this patch is wrong.
Date: 26 Nov 2000 20:00:52 -0800

Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -D_FILE_OFFSET_BITS=64  -I. 
-I/usr/include -I/home/swt/doko/export/packages/bash/bash-2.04 
-I/home/swt/doko/export/packages/bash/bash-2.04/include 
-I/home/swt/doko/export/packages/bash/bash-2.04/lib -I/usr/include -g -O2
uname output: Linux bittersweet 2.4.0-test11 #9 Sat Nov 25 00:42:53 PST 2000 
i586 unknown
Machine Type: i386-pc-linux-gnu

Bash Version: 2.04
Patch Level: 0
Release Status: release

Description:
 This mail is in reference to:

Bash-Release: bash-2.04.0-release
Patch-ID: bash204-007
Bug-Reported-by: jsberg@jsberg1.cap.bnl.gov
Bug-Reference-ID: <200003301604.LAA18064@jsberg1.cap.bnl.gov>

 ... found in the Debian 2.04-9 "bash-2.04/debian/patches/p7.dpatch"
 source package.

 Consider the following example...

 declare -a dirs
 old_IFS="$IFS"
 IFS="$(echo -ne '\000')"
 dirs=($(find . -depth -follow -mindepth 1 -type d -print0 2>/dev/null))
 IFS="$old_IFS"

 ... Note the use of `-print0' in the find command, an attempt at
 preserving spaces in file names, likely common on vfat filesystems;
 perhaps our script is performing maintainence or backups on a machine
 that normally (if you can call that normal) runs Windows while booted
 to Linux temporarily.  (Temporary sanity)

 I had thought, since the info states that command substitution is
 performed before word splitting, that the above snip would yeild an
 array containing the file names, even if some of the file names
 contain oddball characters, such as quote marks, spaces, tabs, or
 even cariage returns and newlines.  This was not the case.  The NUL
 characters are stripped, the file names are run together, and word
 splitting doesn't occur the way I thought it would.

 In order to get what I want, I am forced to explicitly iterate over
 the output of the find command, and assign each array element
 individually.



reply via email to

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