When run by root user (or presumably any user with write privileges on a file), the original file ownership is lost along with original privileges depending on the umask of the user who runs the utility. This is a destructive change and can result in, for example, files that can't be opened by the original creator.
To illustrate:
$ ls -al /tmp/d2utest
-rw-r--r-- 1 cwilliam develop 16 Jun 24 10:24 /tmp/d2utest
$ su -
# dos2unix -q -o /tmp/d2utest
# ls -al /tmp/d2utest
-rw-r--r-- 1 root root 14 Jun 24 10:25 /tmp/d2utest
Contrast with:
# perl -pi -e 's/\r//' /tmp/d2utest
# ls -al /tmp/d2utest
-rw-r--r-- 1 cwilliam develop 14 Jun 24 10:37 /tmp/d2utest
Christopher Williams, McAfee, Inc.
Anonymous
Hi Christopher,
Good point. I will work on this.
Erwin
fix committed to svn revision 310.
Please try version 5.3.1-beta2.
Available on http://waterlan.home.xs4all.nl/dos2unix.html
regards,
Erwin
Updated fix for umask.
Please try version 5.3.1-beta3
Available on http://waterlan.home.xs4all.nl/dos2unix.html
Solved in release 5.3.1.