From nobody Sat May 06 20:23:31 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QDJsc1N7Nz495NY for ; Sat, 6 May 2023 20:23:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QDJsb5gMzz3sdZ for ; Sat, 6 May 2023 20:23:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683404611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j6u9T8KAAJcXKG8/NkMtlgnVmsgJnMkEA/F+ZD1DJ14=; b=C7sdsuMh1UnPe8aHpVgZlLCERUmWAHDz5BVQwS+ao18eH6HS2gkKWRkphG8VKYyBM2nP6g ng6rd0lmOsI7C0RClyHwpbIBCoYb3BT1OgNAfU4v5RYcDeM3nDuIzjKdnwa9X6bXFMWJ/2 oJcmMLrvhQ9JDjvMS3yMfLDv/gkWukctoeDMzwvXfEnBRKVH3eK/7pNVTFvW2KFzQ80YF5 dvYlrRvOLjwiLsGuI3j8mgcuUvyVz4EVONcNa7iUEPVQ12AYlQogdFw8TRE+0sWRKvh9G9 SHS3EWoNH0fMONtxsnbNxfujxfHnvpXYdcn9iLln1czKOeFAKiWZghyInGlO7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683404611; a=rsa-sha256; cv=none; b=kgE0962/RU14lOjw1DeIf6ODQpWP1+IOFIPG/stUioWNtmlIJVmciTI+409/lmow0QJbJu rzdgvOfI3voTnuqXdBWbmEiPS1aK6GfGvFFBwcAmBbhsi9UTY8jx7xBsWABgx5md4Juj3x /FAE5iEsTWn8nh6V2tCgQagh37xIGOsNq0o2ePXuYji3nOLyrD0ROOiQBn5vezX1LNG5mQ +ECpxhaxGvU9nQXckZFCmV/AaFsGuwer23GIOigfDL3XRT1fEoOg3rxVxx0cf92RE2hXMY RhwpgjLsB0t/5XQHFFSFnyZB1NYUDtW+hYFvo/44wQj4QDK3r3cRk/TckXqSow== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QDJsb4P9Gzqlg for ; Sat, 6 May 2023 20:23:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 346KNVQQ062342 for ; Sat, 6 May 2023 20:23:31 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 346KNVuq062341 for bugs@FreeBSD.org; Sat, 6 May 2023 20:23:31 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 271287] etcupdate silently installs empty files / unhandled error in install_new() Date: Sat, 06 May 2023 20:23:31 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: 000.fbsd@quip.cz X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271287 Bug ID: 271287 Summary: etcupdate silently installs empty files / unhandled error in install_new() Product: Base System Version: 13.2-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: 000.fbsd@quip.cz I described it in mailinglist with more verbose details https://lists.freebsd.org/archives/freebsd-stable/2023-April/001271.html https://lists.freebsd.org/archives/freebsd-stable/2023-May/001289.html In some corner cases etcupdate installs 80+ empty files in to /etc/ which m= akes the system unbootable. All files that should be just automatically updated = were installed empty. Vital files like /etc/login.conf, scripts in /etc/rc.d/ an= d so on. etcupdate contains function install_new() which uses "cp -Rp" to copy files= to /etc/ but it does not check if copy failed or not and silently continue. Th= is leads to unbootable system in some corner cases. The function clearly does = not do what it should according to comment above the function. It always return= s 0. # Install the "new" version of a file. Returns true if it succeeds # and false otherwise. # # $1 - pathname of the file to install (relative to DESTDIR) install_new() { if ! install_dirs $NEWTREE "$DESTDIR" $1; then return 1 fi log "cp -Rp ${NEWTREE}$1 ${DESTDIR}$1" if [ -z "$dryrun" ]; then cp -Rp ${NEWTREE}$1 ${DESTDIR}$1 >&3 2>&1 fi post_install_file $1 return 0 }=20 In my case the problem of failing cp -Rp was caused by running etcupdate on upgraded system from 12.3 to 13.2 without reboot so every call of cp -Rp fa= iled with "Function not implemented", but it is not user visible error. etcupdate shows nothing wrong. Those messages are logged in to /var/db/etcupdate/log = but if you run "etcupdate" and because it shows success then "etcupdate resolve" and "etcupdate status" then the log file does not contain anything useful because it is overwritten by each new run of etcupdate. I propose appending to log file instead of overwriting it. Or use some kind= of rotation of at least 5 history files. It was really hard to find what / whe= re is going wrong after the system cannot boot. --=20 You are receiving this mail because: You are the assignee for the bug.=