Message ID | 11eed88b-109b-bfb3-4e5c-be086aa87689@linaro.org |
---|---|
State | New |
Headers | show |
On 04/12/2017 02:35 PM, Adhemerval Zanella wrote: > Ok, here is a version 2. > > -- > > This patch prevents lingering files for SIGSEGV failures by adding > a cleanup handler on trap handler. Checked on x86_64-linux-gnu. > > * posix/globtest.sh: Add cleanup for the signal to act on a trap. Looks reasonable. > +cleanup() Not sure what the preferred style is here, “cleanup () {” or yours. GNU style for shell scripts seems to be 4 space indentation. Thanks, Florian
On 12/04/2017 10:19, Florian Weimer wrote: > On 04/12/2017 02:35 PM, Adhemerval Zanella wrote: >> Ok, here is a version 2. >> >> -- >> >> This patch prevents lingering files for SIGSEGV failures by adding >> a cleanup handler on trap handler. Checked on x86_64-linux-gnu. >> >> * posix/globtest.sh: Add cleanup for the signal to act on a trap. > > Looks reasonable. > >> +cleanup() > > Not sure what the preferred style is here, “cleanup () {” or yours. > > GNU style for shell scripts seems to be 4 space indentation. > > Thanks, > Florian GLIBC usage seems to tend for 'function () {', although there both usage across the scripts. I will change it and use 4 space indentation.
On 04/12/2017 03:19 PM, Florian Weimer wrote:
> GNU style for shell scripts seems to be 4 space indentation.
I may have been wrong about that. It is what Emacs uses, but GNU is
inconsistent. Two spaces are common as well.
Thanks,
Florian
--- a/posix/globtest.sh +++ b/posix/globtest.sh @@ -47,7 +47,13 @@ testout=${common_objpfx}posix/globtest-out rm -rf $testdir $testout mkdir $testdir -trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15 +cleanup() +{ + chmod 777 $testdir/noread + rm -fr $testdir $testout +} + +trap cleanup 0 HUP INT QUIT TERM echo 1 > $testdir/file1 echo 2 > $testdir/file2 @@ -811,8 +817,6 @@ if test $failed -ne 0; then fi if test $result -eq 0; then - chmod 777 $testdir/noread - rm -fr $testdir $testout echo "All OK." > $logfile fi