Re: [PATCH] non-gcc-specific exception.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 07, 2019 at 06:27:29PM +0200, Nicolas Iooss wrote:
> > please find attached the patch to (hopefully) improve
> > self-surgery script that uses gcc-specific -aux-info now.
> > Should help clang, icc and the like (in my case there's
> > no proper gcc port for the target platform just yet).
> How did you test this patch? On my system (Arch Linux x86-64),
> I get the following differences in the generated list of
> functions, for libselinux:
> 
> +select
> +pselect
> -selinuxfs_exists

selinuxfs_exists is declared as just int, not external int, and
gets filtered out with awk one-liner within the original script.

I've spotted select/pselect and have paid some attention to
zeroing the diff *but* overlooked the <stdin> filter in the
script from libselinux-2.9 tagged tree I started looking at.
Evgeny suggested doing something about the changed source
marker format either, shame on me for distracting.

> This is because /usr/include/sys/select.h contains "extern int select
> (int __nfds, fd_set *__restrict __readfds," and "extern int pselect
> (int __nfds, fd_set *__restrict __readfds,", and because
> libselinux/include/selinux/selinux.h contains "int
> selinuxfs_exists(void);" without "extern". Your patch therefore
> changes things in a way that seems unintended.

Will this one do better?  Looks a bit messy though[1]:

gcc -E -I../include -xc ../include/selinux/selinux.h |
  awk -F '[ (]' '/^#/{p=0} \
    /^# .*selinux\/selinux\.h/{p=1} \
    /^extern int/{if(p==1){print $3}}'

> As the regular expression you sent is quite fragile a possible
> way of preventing issues such as the differences I found is
> to try using both methods (-aux-info and -E) in a "make test"
> target and fail with a fatal error when they do not produce
> the same output (this fatal error would be caught by a
> continuous-integration system, which would make the developers
> aware of something wrong).

Good test for those who have it handy, my primary intent was
to be able to at least build without (not-yet-ported) gcc.

> Moreover, please send your patch inline, if possible (for example with
> "git send-email"), and add a "Signed-off-by:" line as documented in
> https://github.com/SELinuxProject/selinux/blob/master/CONTRIBUTING.md#contributing-code.

Thank you for the review and suggestions, please have a look
at the proposed handler replacement; if it's ok I'll arrange
it as a commit and hopefully figure out the test tomorrow,
getting sleepy by now...

---

[1] start/end patterns don't cut it for me given repetitions:

sed -n '/^# .*selinux\/selinux\.h/,/^#/{s/^extern int \(\w*\) *(.*$/\1/p}'

skips e.g. security_deny_unknown given gcc's output
but works fine with somewhat differing lcc's one.

-- 
 ---- WBR, Michael Shigorin / http://altlinux.org
  ------ http://opennet.ru / http://anna-news.info



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux