Bug 21702

Summary: script follows symlinks.
Product: [Retired] Red Hat Linux Reporter: Jeremiah Johnson <mr.miah>
Component: util-linuxAssignee: Erik Troan <ewt>
Status: CLOSED NOTABUG QA Contact: Dale Lovelace <dale>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dr, jarno.huuskonen
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-02-06 20:55:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeremiah Johnson 2000-12-04 22:08:11 UTC
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
peh
[miah@workie miah]$ exitScript done, file is typescript
[miah@workie miah]$ cat peh
Script started on Mon Dec  4 02:19:44 2000
[miah@workie miah]$


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)

Comment 1 Erik Troan 2001-02-06 20:55:27 UTC
This isn't a bug. Most unix command line utilities follow symlinks. It may cause
surprising behavior, but it is correct.