sed 4.1 bug

Bruce Dubbs bdubbs at swbell.net
Thu Jun 17 00:10:44 PDT 2004


Joel Miller wrote:

> 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.
>
I submitted the bug upstream and they accepted the patch.
  -- Bruce





More information about the lfs-dev mailing list