sed 4.2.1-1 locks files on windows

L Anderson lowella@mvseac.com
Wed Feb 22 02:12:00 GMT 2012


Corinna Vinschen wrote:
> On Feb 21 11:58, cygwin.com@munub.e4ward.com wrote:
>> see here: http://stackoverflow.com/questions/9368783/cygwin-bash-sed-locks-my-files
>>
>> When I change files in cygwin bash with the sed command, the file gets locked.
>>
>> Reproduce:
>>
>>      Open cmd and cd to non-user directory (f.e. temp)
>>      echo aaa>  test.txt
>>      Open in texteditor, add line, try to save =>  works
>>      %CYGWIN_HOME%\bin\bash -c "sed -i 's/aaa/bbb/' test.txt
>>      In texteditor, add another line and try to save =>  "Access denied"
>
> I just had a quick look into the aforementioned thread on stackoverflow.
> The answers are a bit off the track.  The problem here is that you mix
> Windows and Cygwin tools in a directory with weird default permissions
> which don't translate nicely to POSIX permissions.
>
> Here's what happens:
>
> - cmd's echo will create the file with default inherited Windows
>    permission bits.  These permission bits don't make a lot of sense
>    from a POSIX point of view.  That's where the ---------+ permissions
>    come from.  That doesn't mean that you have no permissions!  Note
>    the + at the end which means, there's an ACL with additional
>    permissions attached to the file.  Use getfacl(Cygwin) or cacls(Windows)
>    to print the extra ACEs.

NB: On Win 7 one is informed-- "NOTE: Cacls is now deprecated, please 
use Icacls."

Regards,

LA

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list