Package: sed
Version: 4.7-1
Severity: normal

Dear Maintainer,

   * What led up to the situation?
   running sed with inline change option inside of container based on
Debian 10 that runs on Ubuntu 16.04 and docker 18.09.4 makes
permissions corrupted.
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
     sed -i -e 's/ *= */=/' -e 's/=\([^"\'\'']*$\)/='\''\1'\''/'
/opt/app/policy/etc/profile.d/base.conf #but basically can reproduce
it with any match regex pattern with in-line option
     cat /opt/app/policy/etc/profile.d/base.conf # thic command gives
     permission denied.
   * What was the outcome of this action?
     permission denied
   * What outcome did you expect instead?
   output of the file
   * How issue can be fixed (workaround)
   running "touch /opt/app/policy/etc/profile.d/base.conf" fixes the
   problem. chown to the same user that owns file fixes the problem.
   downgrade to sed 4.4-1 fixes the problem.
   * part of strace of sed command. it seems sed is messing with
extended attributes and that might be the reason of the problem:
openat(AT_FDCWD, "/opt/app/policy/etc/profile.d/sed5iOCEE",
O_RDWR|O_CREAT|O_EXCL, 0600) = 4
umask(022)                              = 0700
fcntl(4, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFREG|0755, st_size=2377, ...}) = 0
read(3, "Some content of our file"..., 4096) = 2377
fstat(4, {st_mode=S_IFREG|000, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
fchown(4, 1000, 1000)                   = 0
fgetxattr(3, "system.posix_acl_access", 0x7ffe1ec59da0, 132) = -1
ENODATA (No data available)
fstat(3, {st_mode=S_IFREG|0755, st_size=2377, ...}) = 0
fsetxattr(4, "system.posix_acl_access",
"\2\0\0\0\1\0\7\0\377\377\377\377\4\0\5\0\377\377\377\377
\0\5\0\377\377\377\377", 28, 0) = 0
close(3)                                = 0

   * strace of tail command with permissions denied:
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
openat(AT_FDCWD, "/opt/app/policy/etc/profile.d/base.conf", O_RDONLY)
= -1 EACCES (Permission denied)
write(2, "cat: ", 5cat: )                    = 5
write(2, "/opt/app/policy/etc/profile.d/ba"...,
39/opt/app/policy/etc/profile.d/base.conf) = 39
openat(AT_FDCWD, "/usr/share/locale/C.UTF-8/LC_MESSAGES/libc.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/C.utf8/LC_MESSAGES/libc.mo",
O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/C/LC_MESSAGES/libc.mo", O_RDONLY)
= -1 ENOENT (No such file or directory)
write(2, ": Permission denied", 19: Permission denied)     = 19
write(2, "\n", 1
)                       = 1
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

-- System Information:
Debian Release: 10.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.4.0-169-generic (SMP w/16 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8),
LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages sed depends on:
ii  libacl1      2.2.53-4
ii  libc6        2.28-10
ii  libselinux1  2.8-1+b1

sed recommends no packages.

sed suggests no packages.

-- no debconf information

  • Bug#964169: sed in-line change of file cause corruptio... Marat Salakhutdinov

Reply via email to