pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/check mk/check/check-portability: support file name...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/995ed6be56b6
branches:  trunk
changeset: 424601:995ed6be56b6
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Mar 12 18:40:06 2020 +0000

description:
mk/check/check-portability: support file names with spaces

Before, file names that start or end with spaces were trimmed by read(1),
as specified by POSIX 2004 and POSIX 2018.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html

This edge case bug had been present since the very beginning of this
code, in November 2006.

Filenames containing backslashes or newlines are still not supported, and
probably never will be intentionally supported.

diffstat:

 mk/check/check-portability.sh |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 6ee2d62f8ec3 -r 995ed6be56b6 mk/check/check-portability.sh
--- a/mk/check/check-portability.sh     Thu Mar 12 18:23:14 2020 +0000
+++ b/mk/check/check-portability.sh     Thu Mar 12 18:40:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: check-portability.sh,v 1.14 2020/03/12 08:44:15 rillig Exp $
+# $NetBSD: check-portability.sh,v 1.15 2020/03/12 18:40:06 rillig Exp $
 #
 # This program checks all files in the current directory and any
 # subdirectories for portability issues that are likely to result in
@@ -34,10 +34,13 @@
        fi
 }
 
-find * -type f -print 2>/dev/null \
+find ./* -type f -print 2>/dev/null \
+| sed 's,$,_,' \
 | {
        opsys=`uname -s`-`uname -r`
        while read fname; do
+               fname="${fname#./}"
+               fname="${fname%_}"
 
                skip=no
                eval "case \"\$fname\" in $SKIP_FILTER *.orig) skip=yes;; esac"



Home | Main Index | Thread Index | Old Index