head 1.12; access; symbols pkgsrc-2023Q4:1.12.0.32 pkgsrc-2023Q4-base:1.12 pkgsrc-2023Q3:1.12.0.30 pkgsrc-2023Q3-base:1.12 pkgsrc-2023Q2:1.12.0.28 pkgsrc-2023Q2-base:1.12 pkgsrc-2023Q1:1.12.0.26 pkgsrc-2023Q1-base:1.12 pkgsrc-2022Q4:1.12.0.24 pkgsrc-2022Q4-base:1.12 pkgsrc-2022Q3:1.12.0.22 pkgsrc-2022Q3-base:1.12 pkgsrc-2022Q2:1.12.0.20 pkgsrc-2022Q2-base:1.12 pkgsrc-2022Q1:1.12.0.18 pkgsrc-2022Q1-base:1.12 pkgsrc-2021Q4:1.12.0.16 pkgsrc-2021Q4-base:1.12 pkgsrc-2021Q3:1.12.0.14 pkgsrc-2021Q3-base:1.12 pkgsrc-2021Q2:1.12.0.12 pkgsrc-2021Q2-base:1.12 pkgsrc-2021Q1:1.12.0.10 pkgsrc-2021Q1-base:1.12 pkgsrc-2020Q4:1.12.0.8 pkgsrc-2020Q4-base:1.12 pkgsrc-2020Q3:1.12.0.6 pkgsrc-2020Q3-base:1.12 pkgsrc-2020Q2:1.12.0.4 pkgsrc-2020Q2-base:1.12 pkgsrc-2020Q1:1.12.0.2 pkgsrc-2020Q1-base:1.12 pkgsrc-2019Q4:1.9.0.36 pkgsrc-2019Q4-base:1.9 pkgsrc-2019Q3:1.9.0.32 pkgsrc-2019Q3-base:1.9 pkgsrc-2019Q2:1.9.0.30 pkgsrc-2019Q2-base:1.9 pkgsrc-2019Q1:1.9.0.28 pkgsrc-2019Q1-base:1.9 pkgsrc-2018Q4:1.9.0.26 pkgsrc-2018Q4-base:1.9 pkgsrc-2018Q3:1.9.0.24 pkgsrc-2018Q3-base:1.9 pkgsrc-2018Q2:1.9.0.22 pkgsrc-2018Q2-base:1.9 pkgsrc-2018Q1:1.9.0.20 pkgsrc-2018Q1-base:1.9 pkgsrc-2017Q4:1.9.0.18 pkgsrc-2017Q4-base:1.9 pkgsrc-2017Q3:1.9.0.16 pkgsrc-2017Q3-base:1.9 pkgsrc-2017Q2:1.9.0.12 pkgsrc-2017Q2-base:1.9 pkgsrc-2017Q1:1.9.0.10 pkgsrc-2017Q1-base:1.9 pkgsrc-2016Q4:1.9.0.8 pkgsrc-2016Q4-base:1.9 pkgsrc-2016Q3:1.9.0.6 pkgsrc-2016Q3-base:1.9 pkgsrc-2016Q2:1.9.0.4 pkgsrc-2016Q2-base:1.9 pkgsrc-2016Q1:1.9.0.2 pkgsrc-2016Q1-base:1.9 pkgsrc-2015Q4:1.8.0.16 pkgsrc-2015Q4-base:1.8 pkgsrc-2015Q3:1.8.0.14 pkgsrc-2015Q3-base:1.8 pkgsrc-2015Q2:1.8.0.12 pkgsrc-2015Q2-base:1.8 pkgsrc-2015Q1:1.8.0.10 pkgsrc-2015Q1-base:1.8 pkgsrc-2014Q4:1.8.0.8 pkgsrc-2014Q4-base:1.8 pkgsrc-2014Q3:1.8.0.6 pkgsrc-2014Q3-base:1.8 pkgsrc-2014Q2:1.8.0.4 pkgsrc-2014Q2-base:1.8 pkgsrc-2014Q1:1.8.0.2 pkgsrc-2014Q1-base:1.8 pkgsrc-2013Q4:1.4.0.64 pkgsrc-2013Q4-base:1.4 pkgsrc-2013Q3:1.4.0.62 pkgsrc-2013Q3-base:1.4 pkgsrc-2013Q2:1.4.0.60 pkgsrc-2013Q2-base:1.4 pkgsrc-2013Q1:1.4.0.58 pkgsrc-2013Q1-base:1.4 pkgsrc-2012Q4:1.4.0.56 pkgsrc-2012Q4-base:1.4 pkgsrc-2012Q3:1.4.0.54 pkgsrc-2012Q3-base:1.4 pkgsrc-2012Q2:1.4.0.52 pkgsrc-2012Q2-base:1.4 pkgsrc-2012Q1:1.4.0.50 pkgsrc-2012Q1-base:1.4 pkgsrc-2011Q4:1.4.0.48 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q3:1.4.0.46 pkgsrc-2011Q3-base:1.4 pkgsrc-2011Q2:1.4.0.44 pkgsrc-2011Q2-base:1.4 pkgsrc-2011Q1:1.4.0.42 pkgsrc-2011Q1-base:1.4 pkgsrc-2010Q4:1.4.0.40 pkgsrc-2010Q4-base:1.4 pkgsrc-2010Q3:1.4.0.38 pkgsrc-2010Q3-base:1.4 pkgsrc-2010Q2:1.4.0.36 pkgsrc-2010Q2-base:1.4 pkgsrc-2010Q1:1.4.0.34 pkgsrc-2010Q1-base:1.4 pkgsrc-2009Q4:1.4.0.32 pkgsrc-2009Q4-base:1.4 pkgsrc-2009Q3:1.4.0.30 pkgsrc-2009Q3-base:1.4 pkgsrc-2009Q2:1.4.0.28 pkgsrc-2009Q2-base:1.4 pkgsrc-2009Q1:1.4.0.26 pkgsrc-2009Q1-base:1.4 pkgsrc-2008Q4:1.4.0.24 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.22 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.20 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.18 pkgsrc-2008Q2-base:1.4 cwrapper:1.4.0.16 pkgsrc-2008Q1:1.4.0.14 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.12 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.10 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.8 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.6 pkgsrc-2007Q1-base:1.4 jlam-pkgviews:1.4.0.4 jlam-pkgviews-base:1.4 pkgsrc-2006Q4:1.4.0.2 pkgsrc-2006Q4-base:1.4; locks; strict; comment @# @; 1.12 date 2020.03.18.17.47.40; author joerg; state Exp; branches; next 1.11; commitid F63dp19xqnNnqU0C; 1.11 date 2020.03.13.08.11.36; author rillig; state Exp; branches; next 1.10; commitid QjHjhPclnMhpod0C; 1.10 date 2020.03.13.08.04.08; author rillig; state dead; branches; next 1.9; commitid 38XdyQAxXgMHld0C; 1.9 date 2016.02.24.08.54.23; author jklos; state Exp; branches; next 1.8; commitid ocjPpKThKstCa9Wy; 1.8 date 2014.03.11.23.27.40; author ryoon; state Exp; branches; next 1.7; commitid 1Qpg3N44XWtRYksx; 1.7 date 2014.03.11.23.23.01; author ryoon; state Exp; branches; next 1.6; commitid kDEf3zjQLoVRXksx; 1.6 date 2014.03.11.21.32.11; author ryoon; state Exp; branches; next 1.5; commitid D9F2enDVWPfNlksx; 1.5 date 2014.03.01.17.57.01; author jklos; state Exp; branches; next 1.4; commitid zmQ1u89tH08Qt1rx; 1.4 date 2006.11.13.23.21.53; author rillig; state Exp; branches; next 1.3; 1.3 date 2006.11.10.08.17.06; author rillig; state Exp; branches; next 1.2; 1.2 date 2006.11.09.15.12.15; author rillig; state Exp; branches; next 1.1; 1.1 date 2006.11.09.14.36.18; author rillig; state Exp; branches; next ; desc @@ 1.12 log @Increase developer friendliness by including the line number. @ text @# $NetBSD: check-portability.awk,v 1.11 2020/03/13 08:11:36 rillig Exp $ # # Checks a shell file for possible portability problems. # # ENVIRONMENT # (See check-subr.awk) # BEGIN { found_random = no; found_test_eqeq = no; lineno = 0; } # Check for $RANDOM, which is specific to ksh and bash. function check_random(line, lineno) { # $RANDOM together with the PID is often found in GNU-style # configure scripts and is considered acceptable. if (line ~ /\$\$-\$RANDOM/ || line ~ /\$RANDOM-\$\$/) { # Assume that this is ok. } else if (line ~ /\$RANDOM[A-Z_]+/) { # That's ok, too. } else if (line ~ /\$RANDOM/) { found_random = yes; cs_warning_heading("Found $RANDOM:"); cs_warning_msg(cs_fname ":" lineno ": " $0); } } function check_test_eqeq(line, lineno, n, word, i) { if (length(line) == 0) return; n = split(line, word); for (i = 3; i < n; i++) { if (word[i] == "==") { if (word[i-2] == "test" || word[i-2] == "[") { found_test_eqeq = yes; cs_error_heading("Found test ... == ...:"); cs_error_msg(cs_fname ":" lineno ": " $0); } } } } /^$/ { ++lineno; } /./ { # Note: This code does not find _all_ instances of # unportable code. If a single line contains an unsafe and # a safe usage of $RANDOM, it will pass the test. # Strip comments line = $0; gsub(/^#.*/, "", line); gsub(/[[:space:]]#.*/, "", line); ++lineno; check_random(line, lineno); check_test_eqeq(line, lineno); } END { if (found_random) { h = "The variable $RANDOM is not required for a POSIX-conforming shell, and\n"; h = h "many implementations of /bin/sh do not support it. It should therefore\n"; h = h "not be used in shell programs that are meant to be portable across a\n"; h = h "large number of POSIX-like systems.\n" cs_explain(h); } if (found_test_eqeq) { h = "The \"test\" command, as well as the \"[\" command, are not required to know\n"; h = h "the \"==\" operator. Only a few implementations like bash and some\n"; h = h "versions of ksh support it.\n"; h = h "\n"; h = h "When you run \"test foo == foo\" on a platform that does not support the\n"; h = h "\"==\" operator, the result will be \"false\" instead of \"true\". This can\n"; h = h "lead to unexpected behavior.\n"; h = h "\n"; h = h "There are two ways to fix this error message. If the file that contains\n"; h = h "the \"test ==\" is needed for building the package, you should create a\n"; h = h "patch for it, replacing the \"==\" operator with \"=\". If the file is not\n"; h = h "needed, add its name to the CHECK_PORTABILITY_SKIP variable in the\n"; h = h "package Makefile.\n"; cs_explain(h); } cs_exit(); } @ 1.11 log @mk/check: revert collateral damage from previous commit Killing the editor does not stop cvs from committing; to achieve that, it is necessary to remove the file containing the commit message being edited. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.9 2016/02/24 08:54:23 jklos Exp $ d12 1 d16 1 a16 1 function check_random(line) { d29 1 a29 1 cs_warning_msg(cs_fname ": " $0); d33 1 a33 1 function check_test_eqeq(line, n, word, i) { d43 1 a43 1 cs_error_msg(cs_fname ": " $0); d49 4 d62 1 d64 2 a65 2 check_random(line); check_test_eqeq(line); @ 1.10 log @mk/check/check-perms: allow packages to skip the check completely When all files are skipped, the tool dependency is not added as well. This allows packages to skip the check without defining the user-settable variable CHECK_PERMS. @ text @@ 1.9 log @Fix issue with VAX when awk's split is called with empty string. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.8 2014/03/11 23:27:40 ryoon Exp $ @ 1.8 log @Revert rev. 1.5 @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.7 2014/03/11 23:23:01 ryoon Exp $ d34 2 @ 1.7 log @Revert rev. 1.5 and 1.6 The change introduced in rev. 1.5 disables portability check. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.6 2014/03/11 21:32:11 ryoon Exp $ a33 2 if (length(line) ==0 || length(word) == 0) return; @ 1.6 log @Fix "illegal reference to local variable word" error with lang/nawk under Debian GNU/Linux 7.4. lang/nawk's length(array) does not work as expected. So length(array) make array as usual variable. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.5 2014/03/01 17:57:01 jklos Exp $ a13 9 # length(array) of lang/nawk does not work as expected. function pkgsrc_length(arg, len) { len = 0; for (i in arg) { len++ } return len; } d34 1 a34 1 if (length(line) == 0 || pkgsrc_length(word) == 0) @ 1.5 log @Fixes floating point exceptions on VAX. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.4 2006/11/13 23:21:53 rillig Exp $ d14 9 d43 1 a43 1 if (length(line) == 0 || length(word) == 0) @ 1.4 log @Instead of $0 and $1 .. $NF, the function check_test_eqeq should test the string in the ''line'' variable. This will make koffice build again. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.3 2006/11/10 08:17:06 rillig Exp $ d34 2 @ 1.3 log @Fixed the warning from GNU awk that in strings, \$ is the same as a plain $. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.2 2006/11/09 15:12:15 rillig Exp $ d32 1 a32 1 function check_test_eqeq(line) { d34 4 a37 3 for (i = 3; i < NF; i++) { if ($i == "==") { if ($(i-2) == "test" || $(i-2) == "[") { @ 1.2 log @Added a little comment. The program now exits with the correct exit status in case of errors. @ text @d1 1 a1 1 # $NetBSD: check-portability.awk,v 1.1 2006/11/09 14:36:18 rillig Exp $ d27 1 a27 1 cs_warning_heading("Found \$RANDOM:"); @ 1.1 log @Rewrote check-portability in awk instead of shell, since the shell has a huge performance problem: When reading files, it calls read(2) for every single byte. awk instead reads a whole line at a time. For the lang/php5 package, the execution time changed from (7.8 real 4.5 user 3.1 sys) to (1.6 real 1.5 user 0.4 sys). @ text @d1 7 a7 1 # $NetBSD$ d84 2 @