Bug 255626

Summary: net/samba413: Orphaned files in STAGEDIR
Product: Ports & Packages Reporter: Mark Felder <feld>
Component: Individual Port(s)Assignee: Timur I. Bakeyev <timur>
Status: Open ---    
Severity: Affects Only Me CC: fluffy
Priority: --- Flags: bugzilla: maintainer-feedback? (timur)
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
remove empty files none

Description Mark Felder freebsd_committer 2021-05-05 18:09:33 UTC
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: bin/ecp.QnDgKzC3
Error: Orphaned: bin/ecp.RwhbsIDr
Error: Orphaned: bin/ecp.zkCfXZGw
Error: Orphaned: sbin/ecp.13yuHIqY
Error: Orphaned: sbin/ecp.Q31ZkEo6
Error: Orphaned: sbin/ecp.RQ651qO3
Error: Orphaned: sbin/ecp.iRqOwgUD
Error: Orphaned: sbin/ecp.uuZYIUTL
Error: Orphaned: sbin/ecp.xsOn7p5F

I've looked everywhere trying to figure out how these empty files are being created, but coming up empty handed. Very very strange.
Comment 1 Mark Felder freebsd_committer 2021-05-05 18:10:10 UTC
Created attachment 224699 [details]
remove empty files
Comment 2 Timur I. Bakeyev freebsd_committer 2021-05-05 22:38:38 UTC
Thanks, Mark, your fix, seems, pretty trivial to apply :)

I was trying to translate to `make` this shell construction:

find /usr/local/bin /usr/local/sbin /usr/local/libexec -type f -print0 | \
        ${XARGS} -0 -I % -S 1024 -n 1 ${SH} -c "case \"\`${FILE} --brief --mime-type '%'\`\" in 'application/'*) ${ECHO_CMD} '%' && ${STRIP_CMD} '%';; esac" STRIP

But got lost in additional escapes...

As Dmitry pointed me privately before all the problem exposes itself in FreeBSD 13 environment due clash of two issues:

1. `strip` creates temporary file before it actually starts the processing of the file and, in case it is not strippable(shell script, for example) just leave this temporary file around, without proper cleanup.

2. Before 13 it used to create that temporary file in /tmp, which was excluded from poudriere monitoring, but now the file is created in the same directory where original file is, hence leaving those orphaned temporary files around.

I guess it's worth a separate PR against the bin*, really.