GNU sed version 4.1, bug report

Jeff Hodges jmhodges at lunar-linux.org
Fri Jun 18 03:01:17 GMT 2004


On Fri, 2004-06-18 at 01:46 +0000, Terry Chan wrote:
> sed-4.1 does NOT correctly perform chmod/chown when
> using the "sed -i" (edit in-place) feature.
> 
> sed-4.0.9 does work.
> 
> Simple test case:
> 
> 1. touch this_is_an_empty_testfile
> 2. chmod 755 this_is_an_empty_testfile
> 3. chown 1000:1000 this_is_an_empty_testfile
> 4. sed -i "s/XX/x/" this_is_an_empty_testfile
> 5. ls -al this_is_an_empty_testfile
> 
> And this will now show uid:gid of 0:0 and permissions of 600 for
> this_is_an_empty_testfile
> 
> The problem is located in execute.c and the rewrite/changes in
> 4.1 vs 4.0.9.
> 
> Specifically 4.1 execute.c line 675 still uses:
>   fchmod (output_fd, st.st_mode);
> 
> which is how sed-4.0.9 invokes the chmod as well.  The problem is
> sed-4.1 does NOT use output_fd and now uses output_file.fp !!!!
> Similarly fchown usage is incorrect too as it still uses output_fd,
> but should be using output_file.fp.
> 
> This bug in sed-4.1 clearly breaks the chmod and chown functionality that
> was working in sed-4.0.9.
> 
> Terry Chan
> Lunar Linux Developer
Hey Terry, its your birthday. C'mon, party.. like its your birthday. 
You rock!
-- 
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lunar-linux.org/pipermail/lunar/attachments/20040617/59a404c5/attachment.bin


More information about the Lunar mailing list