diff mbox series

[1/3] libselinux,libsemanage: never create -.o in exception.sh

Message ID 20191111115315.1173097-1-nicolas.iooss@m4x.org (mailing list archive)
State Accepted
Headers show
Series [1/3] libselinux,libsemanage: never create -.o in exception.sh | expand

Commit Message

Nicolas Iooss Nov. 11, 2019, 11:53 a.m. UTC
Files starting with "-" causes issues in commands such as "rm *.o". For
libselinux and libsemanage, when exception.sh fails to remove "-.o",
"make clean" fails with:

    rm: invalid option -- '.'
    Try 'rm ./-.o' to remove the file '-.o'.
    Try 'rm --help' for more information.

Fix this by making exception.sh create "temp.o" instead of "-.o".

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libselinux/src/exception.sh  | 6 +++---
 libsemanage/src/exception.sh | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Stephen Smalley Nov. 12, 2019, 3:35 p.m. UTC | #1
On 11/11/19 6:53 AM, Nicolas Iooss wrote:
> Files starting with "-" causes issues in commands such as "rm *.o". For
> libselinux and libsemanage, when exception.sh fails to remove "-.o",
> "make clean" fails with:
> 
>      rm: invalid option -- '.'
>      Try 'rm ./-.o' to remove the file '-.o'.
>      Try 'rm --help' for more information.
> 
> Fix this by making exception.sh create "temp.o" instead of "-.o".
> 
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Acked-by: Stephen Smalley <sds@tycho.nsa.gov>

> ---
>   libselinux/src/exception.sh  | 6 +++---
>   libsemanage/src/exception.sh | 6 +++---
>   2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libselinux/src/exception.sh b/libselinux/src/exception.sh
> index d6c8c71713ad..1a21e651c42f 100755
> --- a/libselinux/src/exception.sh
> +++ b/libselinux/src/exception.sh
> @@ -15,10 +15,10 @@ echo "
>   ;;
>   esac
>   }
> -if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
> +if ! ${CC:-gcc} -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/selinux/selinux.h
>   then
>       # clang does not support -aux-info so fall back to gcc
> -    gcc -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
> +    gcc -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/selinux/selinux.h
>   fi
>   for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done
> -rm -f -- temp.aux -.o
> +rm -f -- temp.aux temp.o
> diff --git a/libsemanage/src/exception.sh b/libsemanage/src/exception.sh
> index 97bc2ae879f2..fc1d4035a9cd 100644
> --- a/libsemanage/src/exception.sh
> +++ b/libsemanage/src/exception.sh
> @@ -9,10 +9,10 @@ echo "
>   }
>   "
>   }
> -if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h
> +if ! ${CC:-gcc} -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/semanage/semanage.h
>   then
>       # clang does not support -aux-info so fall back to gcc
> -    gcc -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h
> +    gcc -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/semanage/semanage.h
>   fi
>   for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done
> -rm -f -- temp.aux -.o
> +rm -f -- temp.aux temp.o
>
diff mbox series

Patch

diff --git a/libselinux/src/exception.sh b/libselinux/src/exception.sh
index d6c8c71713ad..1a21e651c42f 100755
--- a/libselinux/src/exception.sh
+++ b/libselinux/src/exception.sh
@@ -15,10 +15,10 @@  echo "
 ;;
 esac
 }
-if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
+if ! ${CC:-gcc} -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/selinux/selinux.h
 then
     # clang does not support -aux-info so fall back to gcc
-    gcc -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
+    gcc -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/selinux/selinux.h
 fi
 for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done 
-rm -f -- temp.aux -.o
+rm -f -- temp.aux temp.o
diff --git a/libsemanage/src/exception.sh b/libsemanage/src/exception.sh
index 97bc2ae879f2..fc1d4035a9cd 100644
--- a/libsemanage/src/exception.sh
+++ b/libsemanage/src/exception.sh
@@ -9,10 +9,10 @@  echo "
 }
 "
 }
-if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h
+if ! ${CC:-gcc} -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/semanage/semanage.h
 then
     # clang does not support -aux-info so fall back to gcc
-    gcc -x c -c -I../include - -aux-info temp.aux < ../include/semanage/semanage.h
+    gcc -x c -c -I../include -o temp.o - -aux-info temp.aux < ../include/semanage/semanage.h
 fi
 for i in `awk '/extern int/ { print $6 }' temp.aux`; do except $i ; done
-rm -f -- temp.aux -.o
+rm -f -- temp.aux temp.o