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: New
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:
Depends on:
Blocks:
 
Reported: 2020-10-18 22:34 UTC by Derek Schrock
Modified: 2020-11-21 02:05 UTC (History)
4 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 VVD 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 VVD 2020-10-19 13:36:38 UTC
(In reply to VVD from comment #1)
pkg 1.15.10
12.1-p10 amd64
Comment 3 VVD 2020-11-19 04:21:03 UTC
Any news in fixing this bug?
Comment 4 VVD 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 VVD 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 VVD 2020-11-19 05:05:46 UTC
Revert this change didn't help. :-(

Maybe will test pkg 1.15.6 next time…
Comment 7 VVD 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.