Red Hat Bugzilla – Bug 21702
script follows symlinks.
Last modified: 2007-04-18 12:30:06 EDT
The program "script" from util-linux does not check for file existence
prior to writing output. By default script writes to a file called
"typescript", it can be made to write to other files as well. If a symlink
exists in the place of the typescript file, the file linked could be
destroyed if the user running script has proper privledges.
[miah@workie miah]$ echo "pleh" > peh
[miah@workie miah]$ ln -s peh typescript
[miah@workie miah]$ ls -l peh typescript
-rw-rw-r-- 1 miah miah 5 Dec 4 02:19 peh
lrwxrwxrwx 1 miah miah 3 Dec 4 02:19 typescript -> peh
[miah@workie miah]$ script
Script started, file is typescript[miah@workie miah]$ ls peh
[miah@workie miah]$ exitScript done, file is typescript
[miah@workie miah]$ cat peh
Script started on Mon Dec 4 02:19:44 2000
This problem exists in newest version of util-linux and seems to exist in
all other versions of script. Other platforms/OS's are effected by this
too (including Openbsd 2.6/BSDi 4.1)
This isn't a bug. Most unix command line utilities follow symlinks. It may cause
surprising behavior, but it is correct.