From owner-freebsd-pkg@freebsd.org Sat Apr 20 11:32:49 2019 Return-Path: Delivered-To: freebsd-pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D2D6158B1C5 for ; Sat, 20 Apr 2019 11:32:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 911D18DC8F for ; Sat, 20 Apr 2019 11:32:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 4F858158B1C4; Sat, 20 Apr 2019 11:32:48 +0000 (UTC) Delivered-To: pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CED8158B1C3 for ; Sat, 20 Apr 2019 11:32:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BDADE8DC8E for ; Sat, 20 Apr 2019 11:32:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id EA5B64BCE for ; Sat, 20 Apr 2019 11:32:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x3KBWkgB063103 for ; Sat, 20 Apr 2019 11:32:46 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x3KBWkZf063102 for pkg@FreeBSD.org; Sat, 20 Apr 2019 11:32:46 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: pkg@FreeBSD.org Subject: [Bug 237369] ports-mgmt/pkg: pkg delete removes required NLS directories Date: Sat, 20 Apr 2019 11:32:47 +0000 X-Bugzilla-Reason: AssignedTo CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: se@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: pkg@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? merge-quarterly? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2019 11:32:49 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D237369 --- Comment #2 from Stefan Esser --- Sorry for not making the upgraded port available - after writing the PR I w= as afraid it could cause problems for users that caused them some effort to understand and fix ... I have just committed the version with NLS files (1.2.8) and have further analyzed the problem. My attempt to fix the issue by adding a @postunexec command failed, since these commands are executed before the directory is removed. (I tried "@postunexec /bin/mkdir -p %%LOCALBASE%%/share/nls/C"). I can work around this issue by adding a preexec command that creates the missing directory, but this will not help other ports that install files in= to share/nls. The actual problem is that the port uses message catalog files that are mea= nt to be portable to quite a number of platforms. These are named according to typical locale names, but the install script takes care to only install to existing nls directories (does not create directories with names not common= for the platform like "en_US.cat" or "en_US.utf8" in the case of FreeBSD). The problem is in the automatic cleanup of empty directories performed by p= kg delete if the directory considered is actually a symlink.=20 It would suffice to have pkg keyword like "@precious" or "@keep" to declare some files (or directories, or sub-trees) as not to be cleaned up on uninst= all, but I think this is a general problem that should be solved in "pkg". The cause of the problem is that bc.cat gets installed to "share/nls/en_US.US-ASCII", which actually is a symlink to "share/nls/C" (t= he actual directory). On pkg deletion, the pkg command sees that "share/nls/en_US.US-ASCII" has become empty and tries to delete that directory - but it in fact deletes the symlink target "share/nls/C". If "pkg" was careful to create directories required to install files to bef= ore trying to access them, "share/nls/C" could be re-created (in this case by "mkdir share/nls/en_US.US-ASCII/") then the problem could be worked around. But IMHO, "pkg" should not delete empty directories if the last path compon= ent is a symlink. I.e. do not perform the equivalent of "rmdir share/nls/en_US-ASCII/" but rather "rmdir share/nls/en_US-ASCII". Deleting the symlink indstead of its target would obviously also be wrong: = That would lead to creation of a directory instead of re-creation of the symlink, when a file is to be installed within ... IMHO there is a mis-match between "rmdir share/nls/en_US.US-ASCII/" and "mk= dir -p share/nls/en_US.US-ASCII" (but the problem is in the rmdir, not the mkdi= r). And there are two solutions (besides adding a keyword like @keep): - Perform both rmdir and mkdir on the target of the symlink. - Perform both rmdir and mkdir on the symlink (and ignore the error for operating on a non-directory). I'd prefer to not delete, since I consider directories below share/nls as "infrastructure", even though they are not covered by an mtree definition (AFAIK). Having "share/nls/C" re-appear after a mkdir "share/nls/en_US.US-ASCII/" se= ems surprising - but perhaps the idea to have "POSIX", "en_US.US-ASCII", and "en_US.US_ASCII" all being symlinks to "nls/share/C" is the real problem (w= ith "en_US.US_ASCII" being an outlier anyway - it does not exist for any other = "en" region. And BTW: It is funny to see that there is only "en_IE.UTF-8" and no directo= ry for the corresponding ISO locales or US-ASCII. Maybe this was an oversight = when this locale was created? --=20 You are receiving this mail because: You are the assignee for the bug. You are on the CC list for the bug.=