Menu

#7 dos2unix changes ownership and permissions on the file

closed-accepted
None
5
2015-04-03
2011-06-24
Anonymous
No

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.

Discussion

  • Erwin Waterlander

    Hi Christopher,

    Good point. I will work on this.

    Erwin

     
  • Erwin Waterlander

    • assigned_to: nobody --> waterlan
    • status: open --> open-accepted
     
  • Erwin Waterlander

    fix committed to svn revision 310.

     
  • Erwin Waterlander

    Please try version 5.3.1-beta2.
    Available on http://waterlan.home.xs4all.nl/dos2unix.html

    regards,
    Erwin

     
  • Erwin Waterlander

    Updated fix for umask.
    Please try version 5.3.1-beta3
    Available on http://waterlan.home.xs4all.nl/dos2unix.html

     
  • Erwin Waterlander

    • status: open-accepted --> closed-accepted
     
  • Erwin Waterlander

    Solved in release 5.3.1.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.