Page MenuHomeFreeBSD

fix shebang sheck with links to non-executable files
AbandonedPublic

Authored by lifanov on Sep 25 2017, 10:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 12 2024, 7:05 PM
Unknown Object (File)
Dec 20 2023, 6:27 AM
Unknown Object (File)
Nov 21 2023, 7:40 PM
Unknown Object (File)
Nov 15 2023, 12:39 AM
Unknown Object (File)
Nov 14 2023, 8:10 PM
Unknown Object (File)
Aug 25 2023, 1:36 PM
Unknown Object (File)
Jul 1 2023, 6:34 AM
Unknown Object (File)
Jun 28 2023, 10:29 AM
Subscribers

Details

Reviewers
mat
antoine
Group Reviewers
O5: Ports Framework(Owns No Changed Paths)
portmgr
Summary
For normal files, shebang check is ignored if they are not
executable, but for symlinks this is not the case.

This is a prerequisite of an upcoming sysutils/ansible fix.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 11750
Build 12094: arc lint + arc unit

Event Timeline

antoine added a subscriber: antoine.

I believe this will match directories

This revision now requires changes to proceed.Sep 25 2017, 10:21 PM

address antoine's feedback

Yes, you are correct. Try this please.

I wonder why we check shebang of files that are pointed by symbolic links.

I'm not sure why we check symlinks, but exclusion of executable files pointed to by symlinks doesn't work without this check.

In D12497#259099, @mat wrote:

I wonder why we check shebang of files that are pointed by symbolic links.

Ok, so, the history is:

  1. check every executable files
  2. check only executable files in bin/sbin/libexec/www, but also check symlinks
  3. check every executable files, and symlinks

It seems that the second step should have been removed in rP438168 when we went back to all executable files.

I'd vote for removing all the symlink checks.

Can I commit this fix as-is for now so that I can commit a fix for sysutils/ansible please?

In D12497#259099, @mat wrote:

I wonder why we check shebang of files that are pointed by symbolic links.

It was for the case of /usr/local/bin/foo ->/usr/local/obscuredirectory/foo

But now that we check more than files/links in $PATH , it may no longer be needed

The above check would have caught /usr/local/obscuredirectory/foo without a symlink to it.

$(find ${STAGEDIR}${PREFIX} \
    -type f -perm +111 2>/dev/null)

Yes, I removed the obsolete symlinks thing in rP450638.