bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47380: Atomic install of files


From: Дилян Палаузов
Subject: bug#47380: Atomic install of files
Date: Thu, 25 Mar 2021 12:09:03 +0200
User-agent: Evolution 3.41.1

Hello,

`make install` calls:

/usr/bin/install -c imap/.libs/httpd /usr/local/libexec/

and the syscalls behind are:

newfstatat(AT_FDCWD, "imap/.libs/httpd", {st_mode=S_IFREG|0755,
st_size=3362912, ...}, 0) = 0
newfstatat(AT_FDCWD, "/usr/local/libexec/httpd", {st_mode=S_IFREG|0755,
st_size=3362912, ...}, AT_SYMLINK_NOFOLLOW) = 0
unlink("/usr/local/libexec/httpd")      = 0
openat(AT_FDCWD, "imap/.libs/httpd", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=3362912, ...}) = 0
openat(AT_FDCWD, "/usr/local/libexec/httpd", O_WRONLY|O_CREAT|O_EXCL,
0600) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
ioctl(4, BTRFS_IOC_CLONE or FICLONE, 3) = -1 EOPNOTSUPP (Operation not
supported)
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
mmap(NULL, 139264, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7ff6aad05000
read(3,
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\2\0>\0\1\0\0\0\260\343A\0\0\0\0\0"...,
131072) = 131072
write(4,
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\2\0>\0\1\0\0\0\260\343A\0\0\0\0\0"...,
131072) = 131072
read(3,
"\377H\211\302H\213\205h\372\377\377\211\331H\211\306H\307\307\4\252\35
3\212\350t\0\6\0H\213E\340"..., 131072) = 131072
close(4)                                = 0
close(3)                                = 0
munmap(0x7ff6aad05000, 139264)          = 0
lstat("/usr/local/libexec/httpd", {st_mode=S_IFREG|0600,
st_size=3362912, ...}) = 0
chmod("/usr/local/libexec/httpd", 0755) = 0
lstat("/usr/local/libexec/httpd", {st_mode=S_IFREG|0755,
st_size=3362912, ...}) = 0

That said, the installation is not atomic: the destination file is
opened, truncated, then bytes are written to it.  During the
installation process, the initially executable file is not executable.

Cyrus IMAP is a server-software, which detect whenever its executable
files have changed, terminates the processes with the changed files and
starts the processes again, by re-executing the executables.

This does not work, if the file shall be started, while its content is
being copied: at this time the file is not executable and this is not
good.

• Please adjust `install` to first write the data to a temporary file
and at the end rename(2) the file to the destination, so that the
installation is atomic: the destination file is at all times
executable. (Or provide any means to achieve the atomic copy effect by
Automake)

Kind regards
  Дилян






reply via email to

[Prev in Thread] Current Thread [Next in Thread]