GNU bug report logs - #47380
Atomic install of files

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: Дилян Палаузов <dilyan.palauzov@HIDDEN>; dated Thu, 25 Mar 2021 10:11:01 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Mar 2021 10:10:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 25 06:10:21 2021
Received: from localhost ([127.0.0.1]:37194 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lPMwX-0008KT-Ms
	for submit <at> debbugs.gnu.org; Thu, 25 Mar 2021 06:10:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:44902)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dilyan.palauzov@HIDDEN>) id 1lPMwW-0008KM-Fn
 for submit <at> debbugs.gnu.org; Thu, 25 Mar 2021 06:10:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42938)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dilyan.palauzov@HIDDEN>)
 id 1lPMwT-0000it-Jg
 for bug-coreutils@HIDDEN; Thu, 25 Mar 2021 06:10:18 -0400
Received: from mail.aegee.org ([144.76.142.78]:47160)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dilyan.palauzov@HIDDEN>)
 id 1lPMwP-0000f4-3o
 for bug-coreutils@HIDDEN; Thu, 25 Mar 2021 06:10:17 -0400
Authentication-Results: mail.aegee.org/12PA93uC2908071;
 auth=pass (LOGIN) smtp.auth=didopalauzov@HIDDEN
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aegee.org; s=k4096;
 t=1616666949; i=dkim+MSA-tls@HIDDEN;
 bh=1g2jlbpgXfU42pSmrTT1YxRtTg71liJS6pcywbT7Mf0=;
 h=Subject:From:To:Date;
 b=qcWjVL0Sl/2yuvOHweihr0Im6Hitqvq0ItJGtii8rVJVbZh5liddBfjdFieivH9rU
 /CxVaqTPLFlN2DgpVZ2u6567LbDU5uUOSCivsAIPJb705cDNSpG/35Qz3zxXyk1Arc
 STwE9FSqn0lbP6UztzjE4kiYOdpx58F+MCN6QBXbFTb1q/08kz65xl/tTiHRLm0Ah6
 8k1NVOSmCmKs1GnYT3TUWO38zmaSStmVz8qrrY+7e5Pth99jxX0FNUUqeye+cSXdSv
 kIoqFqsiSX1urFSXYQ/Wg9OQdw/TNOtPY6jE0FgAFsfeuNT7Cc3aJG/Q1oFKLncOUu
 jM2KS9OArINDGUkr/6/6Fko7WO8yW2fAyM4EtO9i4c9niR485CrUr0b1XuyRmCqGK+
 P9O6UIhwYZH90+q8P7tQzeN3XvjpmfjQg8E5R3LhZ4aVPnsbZjk65+CemKB9Dy9s9T
 9pUoOgjNiTzdWrQRwwBKSH/GW4c//QekTbYSLa8XK4ILa0YPmVeIwUacf/biOrvklM
 pj6GDimqD2tbXlidtapbCWxr3nmrkM1THKOvUV3S+q1PO5tI1clrCZlglngmjHpFe5
 XM+BiVDrW2E4aTuIuwm+chYoQFqd3xy/7sj59SVeXH0KlraFgSBUjF7/TnfmrcivMn
 rkX4k/9EyTuq8g/U+b93utpA=
Authentication-Results: mail.aegee.org/12PA93uC2908071; dkim=none
Received: from [192.168.0.199] (87.118.146.153.topnet.bg [87.118.146.153] (may
 be forged)) (authenticated bits=0)
 by mail.aegee.org (8.15.2/8.15.2) with ESMTPSA id 12PA93uC2908071
 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO)
 for <bug-coreutils@HIDDEN>; Thu, 25 Mar 2021 10:09:08 GMT
Message-ID: <33860614a8b0e453f5ad1ab7718d14cc30a4b139.camel@HIDDEN>
Subject: Atomic install of files
From: =?UTF-8?Q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD_?=
 =?UTF-8?Q?=D0=9F=D0=B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=D0=B2?=
 <dilyan.palauzov@HIDDEN>
To: bug-coreutils@HIDDEN
Date: Thu, 25 Mar 2021 12:09:03 +0200
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.41.1 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: none client-ip=144.76.142.78;
 envelope-from=dilyan.palauzov@HIDDEN; helo=mail.aegee.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001,
 SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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
  Дилян





Acknowledgement sent to Дилян Палаузов <dilyan.palauzov@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#47380; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 21 Feb 2022 10:00:02 UTC

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