Subject: Sed --in-place is messing NTFS file permissions

From: Maiko Cezar Rodrigues Costa <[email-masked]>
Date: Wed, 07 Jun 2017 02:45:39 +0000

Hi, I've a problem with sed when using the --in-place option in a mounted
NTFS partition;
$ sed --version
sed (GNU sed) 4.4
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email-masked]>.

$ echo " test string teste" > x

$ sed --in-place=.bak 's@tes.*string@TESTE@g' x

$ ls -l
-rw-r--r-- 1 maiko users   13 jun  6 23:39  x
-rw-r--r-- 1 maiko users   19 jun  6 23:39  x.bak

$ cat x
 TESTE teste

$ cat x.bak
 test string teste

 So far, so good.

 my /etc/fstab

UUID=1CACB8ABACB88136 /media/FILES ntfs defaults,permissions,noatime 0 0

$ cd /media/FILES

$ echo " test string teste" > x

$ sed --in-place=.bak 's@tes.*string@TESTE@g' x

$ ls -l
---------- 1 maiko users   13 jun  6 23:42  x
-rw-r--r-- 1 maiko users   19 jun  6 23:42  x.bak

$ sudo cat x
 TESTE teste

$ cat x.bak
 test string teste

This guy has a very similar problem too
https://unix.stackexchange.com/questions/244603/why-is-sed-changing-permissions-of-a-file-on-a-cifs-mounted-share

Thanks
-- 

Maiko Cezar R Costa

PGP Public Key
<http://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0xB69302C5F63F5F84>