GNU bug report logs - #47380
Atomic install of files

Previous Next

Package: coreutils;

Reported by: Дилян Палаузов <dilyan.palauzov <at> aegee.org>

Date: Thu, 25 Mar 2021 10:11:01 UTC

Severity: wishlist

To reply to this bug, email your comments to 47380 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#47380; Package coreutils. (Thu, 25 Mar 2021 10:11:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Дилян Палаузов <dilyan.palauzov <at> aegee.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 25 Mar 2021 10:11:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Дилян Палаузов
 <dilyan.palauzov <at> aegee.org>
To: bug-coreutils <at> gnu.org
Subject: Atomic install of files
Date: Thu, 25 Mar 2021 12:09:03 +0200
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
  Дилян





Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 21 Feb 2022 09:55:02 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.