sed 4.1 bug

Bruce Dubbs bdubbs at swbell.net
Wed Jun 16 12:07:49 PDT 2004


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





More information about the lfs-dev mailing list