* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
@ 2020-07-16 18:29 ` pullmoll
2020-07-16 18:30 ` [PR REVIEW] " ahesford
` (23 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: pullmoll @ 2020-07-16 18:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 161 bytes --]
New comment by pullmoll on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-659591721
Comment:
Clean solution LGTM
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR REVIEW] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
2020-07-16 18:29 ` pullmoll
@ 2020-07-16 18:30 ` ahesford
2020-07-16 19:09 ` [PR PATCH] [Updated] " Hoshpak
` (22 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2020-07-16 18:30 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
New review comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#discussion_r455987384
Comment:
A test like
```
[[ ${ignore_in_usr_share} != *$(basename "$I")* ]]
```
to the match operator would be consistent with with match tests in the build-helpers.
Regardless, the argument to `basename` should be quoted in case the file has spaces in the name.
Also, why bother stripping out `PKGDESTDIR` from `file` if we are feeding it to basename anyway?
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
2020-07-16 18:29 ` pullmoll
2020-07-16 18:30 ` [PR REVIEW] " ahesford
@ 2020-07-16 19:09 ` Hoshpak
2020-07-16 19:18 ` Hoshpak
` (21 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-16 19:09 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
There is an updated pull request by Hoshpak against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 1208 bytes --]
From 859353d1b27965898f905ece4747d686ebbb77a5 Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..91f38600e02 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -18,7 +18,11 @@ hook() {
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ if [[ ${ignore_in_usr_share} != *$(basename "${file}")* ]]
+ then
+ matches+=" ${file#$PKGDESTDIR}"
+ fi
+ ;;
esac
done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (2 preceding siblings ...)
2020-07-16 19:09 ` [PR PATCH] [Updated] " Hoshpak
@ 2020-07-16 19:18 ` Hoshpak
2020-07-16 19:20 ` Hoshpak
` (20 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-16 19:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]
New comment by Hoshpak on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-659617133
Comment:
Am 16.07.20 um 20:30 schrieb Andrew J. Hesford:
> *@ahesford* requested changes on this pull request.
>
> I think we will always have difficulty with files that might contain spaces in
> the name, because we will not be able to distinguish a file named |File with
> spaces| in |$ignore_in_usr_share| and three separate files named |File|, |with|
> and |spaces|. Using an array instead of space-separated strings avoids this, but
> gets clumsy in the template (if we allow arrays in |ignore_in_usr_share|, why
> not for any other variables?).
I think the general consensus up to know was to keep arrays out of
xbps-src. It will make the code less portable but we use a lot of
bashims already and the general assumption is that it will be run with
bash. Personally I just dislike how arrays are handled in bash and
usually tend to rather rewrite a script in python than having to deal
with them.
> It might also be nice to support directories in |ignore_in_usr_share| so we can
> do things like |usr/share/qemu/firmware| instead of listing each file, but that
> involves a second test and a bit of thought.
In the case of qemu there are just two files which make the hook fail. I
don't know if there are packages with a lot of files which would require
exceptions though.
> |[[ ${ignore_in_usr_share} != *$(basename "$I")* ]] |
>
> to the match operator would be consistent with with match tests in the
> build-helpers.
>
> Regardless, the argument to |basename| should be quoted in case the file has
> spaces in the name.
Thanks, I changed the check as you suggested and verified that it now
works for files with spaces.
> Also, why bother stripping out |PKGDESTDIR| from |file| if we are feeding it to
> basename anyway?
Just an oversight on my part. I removed it.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (3 preceding siblings ...)
2020-07-16 19:18 ` Hoshpak
@ 2020-07-16 19:20 ` Hoshpak
2020-07-16 23:28 ` [PR REVIEW] " Johnnynator
` (19 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-16 19:20 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]
New comment by Hoshpak on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-659617133
Comment:
> *@ahesford* requested changes on this pull request.
>
> I think we will always have difficulty with files that might contain spaces in
> the name, because we will not be able to distinguish a file named |File with
> spaces| in |$ignore_in_usr_share| and three separate files named |File|, |with|
> and |spaces|. Using an array instead of space-separated strings avoids this, but
> gets clumsy in the template (if we allow arrays in |ignore_in_usr_share|, why
> not for any other variables?).
I think the general consensus up to now was to keep arrays out of
xbps-src. It will make the code less portable but we use a lot of
bashims already and the general assumption is that it will be run with
bash. Personally I just dislike how arrays are handled in bash and
usually tend to rather rewrite a script in python than having to deal
with them.
> It might also be nice to support directories in |ignore_in_usr_share| so we can
> do things like |usr/share/qemu/firmware| instead of listing each file, but that
> involves a second test and a bit of thought.
In the case of qemu there are just two files which make the hook fail. I
don't know if there are packages with a lot of files which would require
exceptions though.
> |[[ ${ignore_in_usr_share} != *$(basename "$I")* ]] |
>
> to the match operator would be consistent with with match tests in the
> build-helpers.
>
> Regardless, the argument to |basename| should be quoted in case the file has
> spaces in the name.
Thanks, I changed the check as you suggested and verified that it now
works for files with spaces.
> Also, why bother stripping out |PKGDESTDIR| from |file| if we are feeding it to
> basename anyway?
Just an oversight on my part. I removed it.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR REVIEW] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (4 preceding siblings ...)
2020-07-16 19:20 ` Hoshpak
@ 2020-07-16 23:28 ` Johnnynator
2020-07-16 23:29 ` Johnnynator
` (18 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Johnnynator @ 2020-07-16 23:28 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
New review comment by Johnnynator on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#discussion_r456133358
Comment:
Can't you just compare it to `${file##/*}`, is faster but should give the same output as basename. (find does afaik never give you a path with a trailing `/`)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR REVIEW] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (5 preceding siblings ...)
2020-07-16 23:28 ` [PR REVIEW] " Johnnynator
@ 2020-07-16 23:29 ` Johnnynator
2020-07-17 10:56 ` Piraty
` (17 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Johnnynator @ 2020-07-16 23:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
New review comment by Johnnynator on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#discussion_r456133358
Comment:
Can't you just compare it to `${file##*/}`, is faster but should give the same output as basename. (find does afaik never give you a path with a trailing `/`)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (6 preceding siblings ...)
2020-07-16 23:29 ` Johnnynator
@ 2020-07-17 10:56 ` Piraty
2020-07-20 19:27 ` [PR PATCH] [Updated] " Hoshpak
` (16 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Piraty @ 2020-07-17 10:56 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
New comment by Piraty on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-660040163
Comment:
> In the case of qemu there are just two files which make the hook fail. I don't know if there are packages with a lot of files which would require exceptions though.
yes there are, i remember some microctrontroller firmware development package had to work around the hook really hard
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (7 preceding siblings ...)
2020-07-17 10:56 ` Piraty
@ 2020-07-20 19:27 ` Hoshpak
2020-07-20 19:29 ` Hoshpak
` (15 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-20 19:27 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
There is an updated pull request by Hoshpak against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 1298 bytes --]
From f3154626a14ce9130b99b945ab98c3841419cac8 Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..41c6af5456d 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -18,7 +18,12 @@ hook() {
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ directory=${file%/*}
+ if [[ ${ignore_usrshare_files} != *"${file##*/}"* ]] && [[ ${ignore_usrshare_dirs} != *"${directory##*/}"* ]]
+ then
+ matches+=" ${file#$PKGDESTDIR}"
+ fi
+ ;;
esac
done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (8 preceding siblings ...)
2020-07-20 19:27 ` [PR PATCH] [Updated] " Hoshpak
@ 2020-07-20 19:29 ` Hoshpak
2020-07-20 19:31 ` Hoshpak
` (14 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-20 19:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 422 bytes --]
New comment by Hoshpak on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-661288545
Comment:
> + if [[ ${ignore_in_usr_share} != *$(basename "${file}")* ]]
>
> Can't you just compare it to |${file##/*}|, is faster but should give the same
> output as basename. (find does afaik never give you a path with a trailing |/|)
That works as well. I changed it.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (9 preceding siblings ...)
2020-07-20 19:29 ` Hoshpak
@ 2020-07-20 19:31 ` Hoshpak
2020-07-20 19:53 ` ahesford
` (13 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-20 19:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
New comment by Hoshpak on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-661289627
Comment:
> In the case of qemu there are just two files which make the hook fail. I
> don't know if there are packages with a lot of files which would require
> exceptions though.
>
> yes there are, i remember some microctrontroller firmware development package
> had to work around the hook really hard
Then it is definitely beneficial to be able to exclude directories. I
split it into two variable `ignore_usrshare_files` and
`ignore_usrshare_dirs` in the lates iteration so we can either ignore
individual files or the directory containing the files.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (10 preceding siblings ...)
2020-07-20 19:31 ` Hoshpak
@ 2020-07-20 19:53 ` ahesford
2020-07-22 22:07 ` Chocimier
` (12 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: ahesford @ 2020-07-20 19:53 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-661299884
Comment:
Now that I'm thinking about this again, I wonder if looking at the basename is the right choice. Maybe it should just compare `${file#$PKGDESTDIR}` to the contents of `$ignore_usrshare_files` so we can differentiate files like
```
/usr/share/elf-allowed/myfile
/usr/share/elf-bad/myfile
```
The same should probably hold with `$ignore_usrshare_dirs`: require the full path (wrt `$PKGDESTDIR`) be specified instead of just the basename.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (11 preceding siblings ...)
2020-07-20 19:53 ` ahesford
@ 2020-07-22 22:07 ` Chocimier
2020-07-23 16:34 ` Hoshpak
` (11 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-07-22 22:07 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-662722062
Comment:
Hook operates on usr/share so paths relative to usr/share feels natural. Then we can go crazy and not pass files in ignored directories to file(1). https://github.com/void-linux/void-packages/commit/da030cf5cffe3b845d24cbb9f29f5d12777a9eec
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (12 preceding siblings ...)
2020-07-22 22:07 ` Chocimier
@ 2020-07-23 16:34 ` Hoshpak
2020-07-29 20:54 ` Chocimier
` (10 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-23 16:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 418 bytes --]
New comment by Hoshpak on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-663107934
Comment:
> Hook operates on usr/share so paths relative to usr/share feels natural. Then we can go crazy and not pass files in ignored directories to file(1). https://github.com/void-linux/void-packages/commit/da030cf5cffe3b845d24cbb9f29f5d12777a9eec
>
Looks good, please got for it.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (13 preceding siblings ...)
2020-07-23 16:34 ` Hoshpak
@ 2020-07-29 20:54 ` Chocimier
2020-07-30 15:07 ` Hoshpak
` (9 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-07-29 20:54 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-665921695
Comment:
There was idea to forbid elfs anywhere for noarch packages. In that case, full path would fit better.
> Looks good, please got for it.
When showing changes, I expected you take them into PR if liked them. Do you want me to overtake this PR instead?
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (14 preceding siblings ...)
2020-07-29 20:54 ` Chocimier
@ 2020-07-30 15:07 ` Hoshpak
2020-08-05 20:00 ` [PR PATCH] [Updated] " Chocimier
` (8 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Hoshpak @ 2020-07-30 15:07 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
New comment by Hoshpak on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-666435690
Comment:
> Looks good, please got for it.
>
> When showing changes, I expected you take them into PR if liked them. Do you
> want me to overtake this PR instead?
Yes, please do so.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (15 preceding siblings ...)
2020-07-30 15:07 ` Hoshpak
@ 2020-08-05 20:00 ` Chocimier
2020-08-05 20:00 ` Chocimier
` (7 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-05 20:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 1298 bytes --]
From 3058e2179efdb704daac10ca8a4753ca71c62445 Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..41c6af5456d 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -18,7 +18,12 @@ hook() {
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ directory=${file%/*}
+ if [[ ${ignore_usrshare_files} != *"${file##*/}"* ]] && [[ ${ignore_usrshare_dirs} != *"${directory##*/}"* ]]
+ then
+ matches+=" ${file#$PKGDESTDIR}"
+ fi
+ ;;
esac
done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (16 preceding siblings ...)
2020-08-05 20:00 ` [PR PATCH] [Updated] " Chocimier
@ 2020-08-05 20:00 ` Chocimier
2020-08-05 20:07 ` Chocimier
` (6 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-05 20:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 5756 bytes --]
From 5f6f8c26b8741a1b61d97f54f7a74a6d6c2ec91c Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH 1/3] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
---
.../11-pkglint-elf-in-usrshare.sh | 24 ++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..e586264139b 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,26 +2,44 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
hook() {
- local matches mime file
+ local matches mime file f prune_expr dir
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
return 0
fi
+ if [ "${ignore_elf_dirs}" ]; then
+ for dir in ${ignore_elf_dirs}; do
+ if ! [ "${prune_expr}" ]; then
+ prune_expr="( -path ${PKGDESTDIR}${dir}"
+ else
+ prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
+ fi
+ done
+ prune_expr+=" ) -prune -o "
+ fi
+
# Find all binaries in /usr/share and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
file="${f%:*}"
+ file="${file#${PKGDESTDIR}}"
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ if [[ ${ignore_elf_files} != *"${file}"* ]]
+ then
+ matches+=" ${file}"
+ fi
+ ;;
esac
- done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
+ done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ # Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
From 12c261e215833c7b1d72b26051f52a6fd859fd22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:24:10 +0200
Subject: [PATCH 2/3] 11-pkglint-elf-in-usrshare: check whole noarch packages
---
.../11-pkglint-elf-in-usrshare.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index e586264139b..033c033a3de 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,12 +2,21 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - For noarch packages, looks into /
# - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
hook() {
- local matches mime file f prune_expr dir
+ local matches mime file f prune_expr dir basedir
- if [ ! -d ${PKGDESTDIR}/usr/share ]; then
+ if [ "${archs// /}" = "noarch" ]; then
+ basedir=/
+ found_in="noarch package"
+ else
+ basedir=/usr/share
+ found_in=$basedir
+ fi
+
+ if [ ! -d ${PKGDESTDIR}${basedir} ]; then
return 0
fi
@@ -22,7 +31,7 @@ hook() {
prune_expr+=" ) -prune -o "
fi
- # Find all binaries in /usr/share and add them to the pool
+ # Find all binaries in $basedir and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
@@ -37,14 +46,14 @@ hook() {
fi
;;
esac
- done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ done < <(find ${PKGDESTDIR}${basedir} $prune_expr -type f | file --mime-type --files-from -)
# Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
- msg_red "${pkgver}: ELF files found in /usr/share:\n"
+ msg_red "${pkgver}: ELF files found in ${found_in}:\n"
for f in $matches; do
msg_red " ${f}\n"
done
From 7924f919b249455c89dd87bf3591322f7746eb7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:28:14 +0200
Subject: [PATCH 3/3] 11-pkglint-elf-in-usrshare: disallow x-executable
Can be allowed per-package now
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index 033c033a3de..2c558a90b62 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -38,8 +38,7 @@ hook() {
file="${f%:*}"
file="${file#${PKGDESTDIR}}"
case "${mime}" in
- # Note application/x-executable is missing which is present in most Electron apps
- application/x-sharedlib*|application/x-pie-executable*)
+ application/x-sharedlib*|application/x-pie-executable*|x-executable*)
if [[ ${ignore_elf_files} != *"${file}"* ]]
then
matches+=" ${file}"
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (17 preceding siblings ...)
2020-08-05 20:00 ` Chocimier
@ 2020-08-05 20:07 ` Chocimier
2020-08-05 20:11 ` [PR PATCH] [Updated] " Chocimier
` (5 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-05 20:07 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 273 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-669474720
Comment:
Changed to absolute paths, added checking noarch packages, stepping over ignored directories, disallowed application/x-executable.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (18 preceding siblings ...)
2020-08-05 20:07 ` Chocimier
@ 2020-08-05 20:11 ` Chocimier
2020-08-20 17:50 ` Chocimier
` (4 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-05 20:11 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 5765 bytes --]
From 5f6f8c26b8741a1b61d97f54f7a74a6d6c2ec91c Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH 1/3] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
---
.../11-pkglint-elf-in-usrshare.sh | 24 ++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..e586264139b 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,26 +2,44 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
hook() {
- local matches mime file
+ local matches mime file f prune_expr dir
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
return 0
fi
+ if [ "${ignore_elf_dirs}" ]; then
+ for dir in ${ignore_elf_dirs}; do
+ if ! [ "${prune_expr}" ]; then
+ prune_expr="( -path ${PKGDESTDIR}${dir}"
+ else
+ prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
+ fi
+ done
+ prune_expr+=" ) -prune -o "
+ fi
+
# Find all binaries in /usr/share and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
file="${f%:*}"
+ file="${file#${PKGDESTDIR}}"
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ if [[ ${ignore_elf_files} != *"${file}"* ]]
+ then
+ matches+=" ${file}"
+ fi
+ ;;
esac
- done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
+ done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ # Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
From 4e034a3318117dc94b7427ec340424f08d60713a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:24:10 +0200
Subject: [PATCH 2/3] 11-pkglint-elf-in-usrshare: check whole noarch packages
---
.../11-pkglint-elf-in-usrshare.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index e586264139b..f11c5b5ac76 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,12 +2,21 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - For noarch packages, looks into /
# - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
hook() {
- local matches mime file f prune_expr dir
+ local matches mime file f prune_expr dir basedir found_in
- if [ ! -d ${PKGDESTDIR}/usr/share ]; then
+ if [ "${archs// /}" = "noarch" ]; then
+ basedir=/
+ found_in="noarch package"
+ else
+ basedir=/usr/share
+ found_in=$basedir
+ fi
+
+ if [ ! -d ${PKGDESTDIR}${basedir} ]; then
return 0
fi
@@ -22,7 +31,7 @@ hook() {
prune_expr+=" ) -prune -o "
fi
- # Find all binaries in /usr/share and add them to the pool
+ # Find all binaries in $basedir and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
@@ -37,14 +46,14 @@ hook() {
fi
;;
esac
- done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ done < <(find ${PKGDESTDIR}${basedir} $prune_expr -type f | file --mime-type --files-from -)
# Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
- msg_red "${pkgver}: ELF files found in /usr/share:\n"
+ msg_red "${pkgver}: ELF files found in ${found_in}:\n"
for f in $matches; do
msg_red " ${f}\n"
done
From b0cbe3f212855f03978c262656809e2622a686e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:28:14 +0200
Subject: [PATCH 3/3] 11-pkglint-elf-in-usrshare: disallow x-executable
Can be allowed per-package now
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index f11c5b5ac76..e3987117051 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -38,8 +38,7 @@ hook() {
file="${f%:*}"
file="${file#${PKGDESTDIR}}"
case "${mime}" in
- # Note application/x-executable is missing which is present in most Electron apps
- application/x-sharedlib*|application/x-pie-executable*)
+ application/x-sharedlib*|application/x-pie-executable*|x-executable*)
if [[ ${ignore_elf_files} != *"${file}"* ]]
then
matches+=" ${file}"
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (19 preceding siblings ...)
2020-08-05 20:11 ` [PR PATCH] [Updated] " Chocimier
@ 2020-08-20 17:50 ` Chocimier
2020-08-20 17:50 ` Chocimier
` (3 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-20 17:50 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 5765 bytes --]
From 21968a12f7e62b3e7c5fcfc63d0fb94d3e6029fd Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH 1/3] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
---
.../11-pkglint-elf-in-usrshare.sh | 24 ++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..e586264139b 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,26 +2,44 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
hook() {
- local matches mime file
+ local matches mime file f prune_expr dir
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
return 0
fi
+ if [ "${ignore_elf_dirs}" ]; then
+ for dir in ${ignore_elf_dirs}; do
+ if ! [ "${prune_expr}" ]; then
+ prune_expr="( -path ${PKGDESTDIR}${dir}"
+ else
+ prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
+ fi
+ done
+ prune_expr+=" ) -prune -o "
+ fi
+
# Find all binaries in /usr/share and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
file="${f%:*}"
+ file="${file#${PKGDESTDIR}}"
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ if [[ ${ignore_elf_files} != *"${file}"* ]]
+ then
+ matches+=" ${file}"
+ fi
+ ;;
esac
- done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
+ done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ # Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
From a37631e635a8744e8204c318a413d1ee6985c522 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:24:10 +0200
Subject: [PATCH 2/3] 11-pkglint-elf-in-usrshare: check whole noarch packages
---
.../11-pkglint-elf-in-usrshare.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index e586264139b..f11c5b5ac76 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,12 +2,21 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - For noarch packages, looks into /
# - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
hook() {
- local matches mime file f prune_expr dir
+ local matches mime file f prune_expr dir basedir found_in
- if [ ! -d ${PKGDESTDIR}/usr/share ]; then
+ if [ "${archs// /}" = "noarch" ]; then
+ basedir=/
+ found_in="noarch package"
+ else
+ basedir=/usr/share
+ found_in=$basedir
+ fi
+
+ if [ ! -d ${PKGDESTDIR}${basedir} ]; then
return 0
fi
@@ -22,7 +31,7 @@ hook() {
prune_expr+=" ) -prune -o "
fi
- # Find all binaries in /usr/share and add them to the pool
+ # Find all binaries in $basedir and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
@@ -37,14 +46,14 @@ hook() {
fi
;;
esac
- done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ done < <(find ${PKGDESTDIR}${basedir} $prune_expr -type f | file --mime-type --files-from -)
# Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
- msg_red "${pkgver}: ELF files found in /usr/share:\n"
+ msg_red "${pkgver}: ELF files found in ${found_in}:\n"
for f in $matches; do
msg_red " ${f}\n"
done
From 8da15e11dbd8ce304030fc1f97e14e815c19068c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:28:14 +0200
Subject: [PATCH 3/3] 11-pkglint-elf-in-usrshare: disallow x-executable
Can be allowed per-package now
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index f11c5b5ac76..e3987117051 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -38,8 +38,7 @@ hook() {
file="${f%:*}"
file="${file#${PKGDESTDIR}}"
case "${mime}" in
- # Note application/x-executable is missing which is present in most Electron apps
- application/x-sharedlib*|application/x-pie-executable*)
+ application/x-sharedlib*|application/x-pie-executable*|x-executable*)
if [[ ${ignore_elf_files} != *"${file}"* ]]
then
matches+=" ${file}"
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (20 preceding siblings ...)
2020-08-20 17:50 ` Chocimier
@ 2020-08-20 17:50 ` Chocimier
2020-08-20 17:53 ` Chocimier
` (2 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-20 17:50 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 5331 bytes --]
From b791b8f3a08100ed8ad3e818d2a34b0da91574ae Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH 1/2] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
---
Manual.md | 10 ++++++--
.../11-pkglint-elf-in-usrshare.sh | 24 ++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/Manual.md b/Manual.md
index 8a8954e88d7..4691cbb136b 100644
--- a/Manual.md
+++ b/Manual.md
@@ -141,7 +141,7 @@ to be accepted. New fonts are welcome if they provide value beyond
aesthetics (e.g. they contain glyphs for a script missing in already
packaged fonts).
-Browser forks, including those based on Chromium and Firefox, are generally not
+Browser forks, including those based on Chromium and Firefox, are generally not
accepted. Such forks require heavy patching, maintenance and hours of build time.
<a id="buildphase"></a>
@@ -623,6 +623,12 @@ the `$DESTDIR` which will not be scanned for runtime dependencies. This may be u
skip files which are not meant to be run or loaded on the host but are to be sent to some
target device or emulation.
+- `ignore_elf_files` White space separated list of machine code files
+in /usr/share directory specified by absolute path, which are expected and allowed.
+
+- `ignore_elf_dirs` White space separated list of directories in /usr/share directory
+specified by absolute path, which are expected and allowed to contain machine code files.
+
- `nocross` If set, cross compilation won't be allowed and will exit immediately.
This should be set to a string describing why it fails, or a link to a travis
buildlog demonstrating the failure.
@@ -950,7 +956,7 @@ Environment variables for a specific `build_style` can be declared in a filename
matching the `build_style` name, Example:
`common/environment/build-style/gnu-configure.sh`
-
+
- `texmf` For texmf zip/tarballs that need to go into /usr/share/texmf-dist. Includes
duplicates handling.
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..a1ec9484bf4 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,26 +2,44 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - Allows exceptions listed in $ignore_elf_files and $ignore_elf_dirs
hook() {
- local matches mime file
+ local matches mime file f prune_expr dir
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
return 0
fi
+ if [ "${ignore_elf_dirs}" ]; then
+ for dir in ${ignore_elf_dirs}; do
+ if ! [ "${prune_expr}" ]; then
+ prune_expr="( -path ${PKGDESTDIR}${dir}"
+ else
+ prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
+ fi
+ done
+ prune_expr+=" ) -prune -o "
+ fi
+
# Find all binaries in /usr/share and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
file="${f%:*}"
+ file="${file#${PKGDESTDIR}}"
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ if [[ ${ignore_elf_files} != *"${file}"* ]]
+ then
+ matches+=" ${file}"
+ fi
+ ;;
esac
- done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
+ done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ # Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
From dbc4e70e8e76628bffcd8d0d09c9ca7182302994 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:28:14 +0200
Subject: [PATCH 2/2] 11-pkglint-elf-in-usrshare: disallow x-executable
Can be allowed per-package now
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index a1ec9484bf4..7d6c9e73aa9 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -29,8 +29,9 @@ hook() {
file="${f%:*}"
file="${file#${PKGDESTDIR}}"
case "${mime}" in
- # Note application/x-executable is missing which is present in most Electron apps
- application/x-sharedlib*|application/x-pie-executable*)
+ application/x-sharedlib*|\
+ application/x-pie-executable*|\
+ application/x-executable*)
if [[ ${ignore_elf_files} != *"${file}"* ]]
then
matches+=" ${file}"
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (21 preceding siblings ...)
2020-08-20 17:50 ` Chocimier
@ 2020-08-20 17:53 ` Chocimier
2020-08-25 19:14 ` [PR PATCH] [Updated] " Chocimier
2020-08-25 19:19 ` [PR PATCH] [Merged]: " Chocimier
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-20 17:53 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 233 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/23601#issuecomment-677810387
Comment:
Reverted check of noarch packages, described in manual. Will merge if no further comments.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (22 preceding siblings ...)
2020-08-20 17:53 ` Chocimier
@ 2020-08-25 19:14 ` Chocimier
2020-08-25 19:19 ` [PR PATCH] [Merged]: " Chocimier
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-25 19:14 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 5319 bytes --]
From d5ca1af76778b15590be6d56085e5531749fd5c6 Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH 1/2] 11-pkglint-elf-in-usrshare: allow explicit setting of
exceptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
---
Manual.md | 10 ++++++--
.../11-pkglint-elf-in-usrshare.sh | 23 ++++++++++++++++---
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/Manual.md b/Manual.md
index 8a8954e88d7..4691cbb136b 100644
--- a/Manual.md
+++ b/Manual.md
@@ -141,7 +141,7 @@ to be accepted. New fonts are welcome if they provide value beyond
aesthetics (e.g. they contain glyphs for a script missing in already
packaged fonts).
-Browser forks, including those based on Chromium and Firefox, are generally not
+Browser forks, including those based on Chromium and Firefox, are generally not
accepted. Such forks require heavy patching, maintenance and hours of build time.
<a id="buildphase"></a>
@@ -623,6 +623,12 @@ the `$DESTDIR` which will not be scanned for runtime dependencies. This may be u
skip files which are not meant to be run or loaded on the host but are to be sent to some
target device or emulation.
+- `ignore_elf_files` White space separated list of machine code files
+in /usr/share directory specified by absolute path, which are expected and allowed.
+
+- `ignore_elf_dirs` White space separated list of directories in /usr/share directory
+specified by absolute path, which are expected and allowed to contain machine code files.
+
- `nocross` If set, cross compilation won't be allowed and will exit immediately.
This should be set to a string describing why it fails, or a link to a travis
buildlog demonstrating the failure.
@@ -950,7 +956,7 @@ Environment variables for a specific `build_style` can be declared in a filename
matching the `build_style` name, Example:
`common/environment/build-style/gnu-configure.sh`
-
+
- `texmf` For texmf zip/tarballs that need to go into /usr/share/texmf-dist. Includes
duplicates handling.
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..bd0a4f25725 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,26 +2,43 @@
#
# This hook executes the following tasks:
# - Looks on all packages for binary files being installed to /usr/share
+# - Allows exceptions listed in $ignore_elf_files and $ignore_elf_dirs
hook() {
- local matches mime file
+ local matches mime file f prune_expr dir
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
return 0
fi
+ if [ "${ignore_elf_dirs}" ]; then
+ for dir in ${ignore_elf_dirs}; do
+ if ! [ "${prune_expr}" ]; then
+ prune_expr="( -path ${PKGDESTDIR}${dir}"
+ else
+ prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
+ fi
+ done
+ prune_expr+=" ) -prune -o "
+ fi
+
# Find all binaries in /usr/share and add them to the pool
while read -r f; do
mime="${f##*:}"
mime="${mime// /}"
file="${f%:*}"
+ file="${file#${PKGDESTDIR}}"
case "${mime}" in
# Note application/x-executable is missing which is present in most Electron apps
application/x-sharedlib*|application/x-pie-executable*)
- matches+=" ${file#$PKGDESTDIR}" ;;
+ if [[ ${ignore_elf_files} != *"${file}"* ]]; then
+ matches+=" ${file}"
+ fi
+ ;;
esac
- done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
+ done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+ # Check passed if no packages in pool
if [ -z "$matches" ]; then
return 0
fi
From 839a7f9efec1777fbe2be128bf2f69d3da6bd5f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:28:14 +0200
Subject: [PATCH 2/2] 11-pkglint-elf-in-usrshare: disallow x-executable
Can be allowed per-package now
---
common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index bd0a4f25725..a665f3ed94d 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -29,8 +29,9 @@ hook() {
file="${f%:*}"
file="${file#${PKGDESTDIR}}"
case "${mime}" in
- # Note application/x-executable is missing which is present in most Electron apps
- application/x-sharedlib*|application/x-pie-executable*)
+ application/x-sharedlib*|\
+ application/x-pie-executable*|\
+ application/x-executable*)
if [[ ${ignore_elf_files} != *"${file}"* ]]; then
matches+=" ${file}"
fi
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PR PATCH] [Merged]: [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
2020-07-16 17:46 [PR PATCH] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions Hoshpak
` (23 preceding siblings ...)
2020-08-25 19:14 ` [PR PATCH] [Updated] " Chocimier
@ 2020-08-25 19:19 ` Chocimier
24 siblings, 0 replies; 26+ messages in thread
From: Chocimier @ 2020-08-25 19:19 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
There's a merged pull request on the void-packages repository
[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
https://github.com/void-linux/void-packages/pull/23601
Description:
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.
@void-linux/pkg-committers
^ permalink raw reply [flat|nested] 26+ messages in thread