dash & IFS

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

 



Good morning,

Few days ago, I noticed something strange with dash and IFS. It was
verified with the following versions :

- 0.5.10.2 on Voidlinux
- 0.5.10.2 on Debian Buster
- 0.5.8 on Ubuntu 18.04.2 LTS (Bionic Beaver)

Here the issue :

$ ls
file.sign  file1  file2  other.sign  whileifs*
$ cat whileifs
#!/bin/dash

find . -type f | sort -d | while IFS=$'\n' read -r F; do
	printf "%s\n" "$F"
done
$ ./whileifs
./file1
./file2
./file.sig
./other.sig
./whileifs

file.sig and other.sig are returned instead of file.sign and other.sign.

Here the result with bash :
$ bash whileifs
./file1
./file2
./file.sign
./other.sign
./whileifs

Here the result with mksh :
$ mksh whileifs
./file1
./file2
./file.sign
./other.sign
./whileifs

Here the result with lksh :
$ lksh whileifs
./file1
./file2
./file.sign
./other.sign
./whileifs

Here the result with busybox ash (1.31.0) :
$ /tmp/busybox-x86_64 ash whileifs
./file1
./file2
./file.sign
./other.sign
./whileifs

I attached the test directory. Can you reproduce it ?

Sincerely
Y

Attachment: dashifs.tar.gz
Description: application/gzip


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux