sed 4.1 bug

Joel Miller cheeziologist at mail.isc.rit.edu
Wed Jun 16 23:03:40 PDT 2004


Bruce Dubbs wrote:
> When using the in-place function, sed 4.1 changes permissions.  
> Specifically, when using sed on a bash script with permissions 755, the 
> updated file has permissions 600.
> 
> Here is a patch that fixes the problem.
> 
> 
> diff -Naur sed-4.1.orig/sed/execute.c sed-4.1/sed/execute.c
> --- sed-4.1.orig/sed/execute.c  Wed Jun 16 14:00:57 2004
> +++ sed-4.1/sed/execute.c       Wed Jun 16 14:02:36 2004
> @@ -668,6 +668,7 @@
>  
>        input->in_file_name = name;
>        output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, "sed");
> +      output_fd = fileno(output_file.fp);
>        free (tmpdir);
>  
>        fstat (fileno (input->fp), &st);
> 
> 
>   -- Bruce Dubbs
>      bdubbs at linuxfromscratch.org
> 
> 

An alternate patch was posted on -hackers today, although yours seems 
simpler than the solution posted to -hackers.

-- 
Registered LFS User 6929
Registered Linux User 298182



More information about the lfs-dev mailing list