Bug 250439 - check leftovers phase fails if @sample is a symlink with pkg 1.15.7+
Summary: check leftovers phase fails if @sample is a symlink with pkg 1.15.7+
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords: regression
Depends on: 253292
Blocks: 250415
  Show dependency treegraph
 
Reported: 2020-10-18 22:34 UTC by Derek Schrock
Modified: 2021-02-26 15:39 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Derek Schrock 2020-10-18 22:34:26 UTC
Since pkg 1.15.7 poudriere testport fails during leftovers phase if there's a @sample file that's a symlink.

You can see this by running poudriere testport on www/tt-rss.  Since config.php.sample is a symlink to config.php-dist poudriere testport fails during leftovers phase with the following message:

  ...
  ===========================================================================
  =>> Checking for extra files and directories
  =>> Error: Files or directories left over:
  %%WWWDIR%%/config.php
  @dir %%WWWOWN%%
  ...


Turning the @sample file into a real file fixes the issue however is this something that the ports framework should support?  Allowing a @sample file to be a symlink?

If so then is this a pkg issue with 1.15.7 or does the ports framework need updated to support the change from pkg 1.15.7?


PS: The above output from poudriere also shows another bug in the output of check_leftovers.sh due the sed sub/replace %%WWWDIR%% gets replaced with %%WWWOWN%%.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2020-10-19 13:29:54 UTC
Same here with www/tomcat{7,85,9,-devel} ports if /usr/local/apache-tomcat-{7,85,9,-devel} is symlink - installed *.sample files, but not files self.
For example in conf there instaled only:
catalina.policy.sample
catalina.properties.sample
context.xml.sample
jaspic-providers.xml.sample
logging.properties.sample
server.xml.sample
tomcat-users.xml.sample
web.xml.sample

Without:
catalina.policy
catalina.properties
context.xml
jaspic-providers.xml
logging.properties
server.xml
tomcat-users.xml
web.xml

Derek, you can mark change "Importance" to at least "Affects Some People".
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2020-10-19 13:36:38 UTC
(In reply to VVD from comment #1)
pkg 1.15.10
12.1-p10 amd64
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2020-11-19 04:21:03 UTC
Any news in fixing this bug?
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2020-11-19 04:35:02 UTC
(In reply to Derek Schrock from comment #0)
> Since pkg 1.15.7
Are you sure about version number?

diff -urN pkg-1.15.6/NEWS pkg-1.15.7/NEWS
--- pkg-1.15.6/NEWS
+++ pkg-1.15.7/NEWS
@@ -1,3 +1,6 @@
+Changes from 1.15.6 to 1.15.7
+- Fix '%#' usage in scripts
+
 Changes from 1.15.5 to 1.15.6
 - Fix '%X' to include the file name and sum
 
diff -urN pkg-1.15.6/libpkg/utils.c pkg-1.15.7/libpkg/utils.c
--- pkg-1.15.6/libpkg/utils.c
+++ pkg-1.15.7/libpkg/utils.c
@@ -259,7 +259,7 @@
                         */
                        /* FALLTHRU */
                case '#':
-                       utstring_printf(buf, "%c", argc);
+                       utstring_printf(buf, "%d", argc);
                        break;
                default:
                        if ((sz = strspn(in, "0123456789")) > 0) {

Can you check different versions of pkg: https://github.com/freebsd/pkg/releases ?
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2020-11-19 04:44:10 UTC
This diff look like source of this bug:

diff -urN pkg-1.15.8/NEWS pkg-1.15.9/NEWS
--- pkg-1.15.8/NEWS
+++ pkg-1.15.9/NEWS
@@ -1,3 +1,6 @@
+Changes from 1.15.8 to 1.15.9
+- Fix lua_pkg_copy when copying a symlink
+
 Changes from 1.15.7 to 1.15.8
 - Fix a typo making the detection of lua scripts in manifest
   unreliable in certain circumpstances
diff -urN pkg-1.15.8/auto.def pkg-1.15.9/auto.def
--- pkg-1.15.8/auto.def
+++ pkg-1.15.9/auto.def
@@ -5,7 +5,7 @@
 
 set maj_ver 1
 set med_ver 15
-set min_ver 8
+set min_ver 9
 set dev_ver 0
 define PKG_API [expr $maj_ver * 1000000 + $med_ver * 1000 + $min_ver]
 define VERSION $maj_ver.$med_ver.$min_ver[expr {$dev_ver ? ".$dev_ver" : ""}]
diff -urN pkg-1.15.8/libpkg/lua_scripts.c pkg-1.15.9/libpkg/lua_scripts.c
--- pkg-1.15.8/libpkg/lua_scripts.c
+++ pkg-1.15.9/libpkg/lua_scripts.c
@@ -122,7 +122,7 @@
        lua_getglobal(L, "package");
        struct pkg *pkg = lua_touserdata(L, -1);
 
-       if (fstatat(pkg->rootfd, RELATIVE_PATH(src), &s1, AT_SYMLINK_NOFOLLOW) == -1) {
+       if (fstatat(pkg->rootfd, RELATIVE_PATH(src), &s1, 0) == -1) {
                lua_pushinteger(L, 2);
                return (1);
        }

Will test it now.
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2020-11-19 05:05:46 UTC
Revert this change didn't help. :-(

Maybe will test pkg 1.15.6 next time…
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2020-11-21 02:05:15 UTC
(In reply to VVD from comment #6)
Tested 1.15.6 - same bug.
Look like ports infrastructure (scripts/makefiles) bug.
Comment 8 Matthias Andree freebsd_committer freebsd_triage 2021-02-06 15:51:10 UTC
The issue persists in pkg 1.16.2, and with your patch from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250439#c5 you'd also need to look at lua_pkg_filecmp() and patch those two fstatat() calls there, too. Maybe more. 

Also see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253292
Comment 9 commit-hook freebsd_committer freebsd_triage 2021-02-18 18:05:45 UTC
A commit references this bug:

Author: manu
Date: Thu Feb 18 18:04:46 UTC 2021
New revision: 565957
URL: https://svnweb.freebsd.org/changeset/ports/565957

Log:
  ports-mgmt/pkg-devel: Update to 1.16.99.2

  - libpkg: rsa: stop leaking an RSA object
  - libpkg: rsa: start abstracting away rsa bits
  - lua: filecmp: Fix for symlink

  PR:		253292, 250439
  Approved by:	bapt (implicit)

Changes:
  head/ports-mgmt/pkg-devel/Makefile
  head/ports-mgmt/pkg-devel/distinfo
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-02-18 18:11:47 UTC
A commit references this bug:

Author: manu
Date: Thu Feb 18 18:11:07 UTC 2021
New revision: 565958
URL: https://svnweb.freebsd.org/changeset/ports/565958

Log:
  ports-mgmt/pkg: Update to 1.16.3

  - lua: filecmp: Fix for symlink

  PR:	253292, 250439
  Approved by:	bapt (implicit)
  MFH:		2021Q1

Changes:
  head/ports-mgmt/pkg/Makefile
  head/ports-mgmt/pkg/distinfo
Comment 11 commit-hook freebsd_committer freebsd_triage 2021-02-18 18:13:55 UTC
A commit references this bug:

Author: manu
Date: Thu Feb 18 18:13:34 UTC 2021
New revision: 565960
URL: https://svnweb.freebsd.org/changeset/ports/565960

Log:
  MFH: r562140 r565958

  ports-mgmt/pkg: Update to 1.16.2

  Changes from 1.16.1 to 1.16.2
  - libpkg: add a snap(shot) version prefix
  - libpkg: only upgrade installed packages with pattern matches
  - Document pkg-lock(8) accepts a list of packages

  Approved by:	bapt (implicit)

  ports-mgmt/pkg: Update to 1.16.3

  - lua: filecmp: Fix for symlink

  PR:	253292, 250439
  Approved by:	bapt (implicit)

Changes:
_U  branches/2021Q1/
  branches/2021Q1/ports-mgmt/pkg/Makefile
  branches/2021Q1/ports-mgmt/pkg/distinfo
Comment 12 Vladimir Druzenko freebsd_committer freebsd_triage 2021-02-21 07:33:43 UTC
It's fixed now for my ports.