Sat May 23 22:18:11 2020 UTC ()
pkgtools/check-portability: update to 20.1.1

Changes since 20.1.0:

Fixed off-by-one error in diagnostic for test ==.


(rillig)
diff -r1.9 -r1.10 pkgsrc/pkgtools/check-portability/Makefile
diff -r1.15 -r1.16 pkgsrc/pkgtools/check-portability/files/check-portability.c
diff -r1.1 -r1.2 pkgsrc/pkgtools/check-portability/files/testdata/zzz_expected

cvs diff -r1.9 -r1.10 pkgsrc/pkgtools/check-portability/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/check-portability/Makefile 2020/04/19 12:05:14 1.9
+++ pkgsrc/pkgtools/check-portability/Makefile 2020/05/23 22:18:10 1.10
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1# $NetBSD: Makefile,v 1.9 2020/04/19 12:05:14 rillig Exp $ 1# $NetBSD: Makefile,v 1.10 2020/05/23 22:18:10 rillig Exp $
2 2
3PKGNAME= check-portability-20.1.0 3PKGNAME= check-portability-20.1.1
4CATEGORIES= pkgtools 4CATEGORIES= pkgtools
5DISTFILES= # none 5DISTFILES= # none
6 6
7MAINTAINER= rillig@NetBSD.org 7MAINTAINER= rillig@NetBSD.org
8HOMEPAGE= # none 8HOMEPAGE= # none
9COMMENT= Check extracted files for typical portability issues 9COMMENT= Check extracted files for typical portability issues
10LICENSE= 2-clause-bsd 10LICENSE= 2-clause-bsd
11 11
12USE_TOOLS+= cp 12USE_TOOLS+= cp
13CHECK_PORTABILITY_SKIP= * # avoid circular dependency 13CHECK_PORTABILITY_SKIP= * # avoid circular dependency
14CHECK_PERMS_SKIP= * # avoid circular dependency 14CHECK_PERMS_SKIP= * # avoid circular dependency
15USE_LANGUAGES= c99 15USE_LANGUAGES= c99
16USE_BSD_MAKEFILE= yes 16USE_BSD_MAKEFILE= yes

cvs diff -r1.15 -r1.16 pkgsrc/pkgtools/check-portability/files/check-portability.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/check-portability/files/check-portability.c 2020/05/23 22:12:31 1.15
+++ pkgsrc/pkgtools/check-portability/files/check-portability.c 2020/05/23 22:18:11 1.16
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: check-portability.c,v 1.15 2020/05/23 22:12:31 rillig Exp $ */ 1/* $NetBSD: check-portability.c,v 1.16 2020/05/23 22:18:11 rillig Exp $ */
2 2
3/* 3/*
4 Copyright (c) 2020 Roland Illig 4 Copyright (c) 2020 Roland Illig
5 All rights reserved. 5 All rights reserved.
6 6
7 Redistribution and use in source and binary forms, with or without 7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions 8 modification, are permitted provided that the following conditions
9 are met: 9 are met:
10 10
11 1. Redistributions of source code must retain the above copyright 11 1. Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer. 12 notice, this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright 13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the 14 notice, this list of conditions and the following disclaimer in the
@@ -391,27 +391,27 @@ checkline_sh_dollar_random(cstr filename @@ -391,27 +391,27 @@ checkline_sh_dollar_random(cstr filename
391 391
392struct checkline_sh_test_eqeq_actiondata { 392struct checkline_sh_test_eqeq_actiondata {
393 cstr filename; 393 cstr filename;
394 size_t lineno; 394 size_t lineno;
395 cstr line; 395 cstr line;
396}; 396};
397 397
398static void 398static void
399checkline_sh_test_eqeq_error( 399checkline_sh_test_eqeq_error(
400 cstr filename, cstr line, size_t lineno, size_t column) 400 cstr filename, cstr line, size_t lineno, size_t column)
401{ 401{
402 printf( 402 printf(
403 "%s:%zu:%zu: found test ... == ...: %s\n", 403 "%s:%zu:%zu: found test ... == ...: %s\n",
404 cstr_charptr(filename), lineno, column, cstr_charptr(line)); 404 cstr_charptr(filename), lineno, column + 1, cstr_charptr(line));
405 nerrors++; 405 nerrors++;
406 explain( 406 explain(
407 W_test_eqeq, 407 W_test_eqeq,
408 "The \"test\" command, as well as the \"[\" command, are not required to know", 408 "The \"test\" command, as well as the \"[\" command, are not required to know",
409 "the \"==\" operator. Only a few implementations like bash and some", 409 "the \"==\" operator. Only a few implementations like bash and some",
410 "versions of ksh support it.", 410 "versions of ksh support it.",
411 "", 411 "",
412 "When you run \"test foo == foo\" on a platform that does not support the", 412 "When you run \"test foo == foo\" on a platform that does not support the",
413 "\"==\" operator, the result will be \"false\" instead of \"true\". This can", 413 "\"==\" operator, the result will be \"false\" instead of \"true\". This can",
414 "lead to unexpected behavior.", 414 "lead to unexpected behavior.",
415 nullptr); 415 nullptr);
416 explain_how_to_fix(); 416 explain_how_to_fix();
417} 417}

cvs diff -r1.1 -r1.2 pkgsrc/pkgtools/check-portability/files/testdata/zzz_expected (expand / switch to unified diff)

--- pkgsrc/pkgtools/check-portability/files/testdata/zzz_expected 2020/03/21 15:02:20 1.1
+++ pkgsrc/pkgtools/check-portability/files/testdata/zzz_expected 2020/05/23 22:18:11 1.2
@@ -13,33 +13,33 @@ files/testdata/Makefile.am:7:5: double b @@ -13,33 +13,33 @@ files/testdata/Makefile.am:7:5: double b
13 for the package to build. Then choose any of these variants: 13 for the package to build. Then choose any of these variants:
14 14
15 1. Add a patch for the file 15 1. Add a patch for the file
16 (see https://www.netbsd.org/docs/pkgsrc/pkgsrc.html#components.patches) 16 (see https://www.netbsd.org/docs/pkgsrc/pkgsrc.html#components.patches)
17 2. Add a SUBST block for the file to the package Makefile 17 2. Add a SUBST block for the file to the package Makefile
18 (see mk/subst.mk) 18 (see mk/subst.mk)
19 3. Add CHECK_PORTABILITY_SKIP+= shell/glob to the package Makefile 19 3. Add CHECK_PORTABILITY_SKIP+= shell/glob to the package Makefile
20 (see mk/check/check-portability.mk) 20 (see mk/check/check-portability.mk)
21 21
22files/testdata/Makefile.am:8:5: double brackets: if [[ ${COND} ]] || [[ $(COND) ]]; then :; fi 22files/testdata/Makefile.am:8:5: double brackets: if [[ ${COND} ]] || [[ $(COND) ]]; then :; fi
23files/testdata/double-brackets:8:4: double brackets: if [[ test ]]; then 23files/testdata/double-brackets:8:4: double brackets: if [[ test ]]; then
24files/testdata/double-brackets:10:1: double brackets: [[ test ]] 24files/testdata/double-brackets:10:1: double brackets: [[ test ]]
25files/testdata/double-brackets:12:1: double brackets: [[ test ]] || echo 25files/testdata/double-brackets:12:1: double brackets: [[ test ]] || echo
26files/testdata/env-sh:8:4: found test ... == ...: [ a == b ] 26files/testdata/env-sh:8:5: found test ... == ...: [ a == b ]
27 27
28 The "test" command, as well as the "[" command, are not required to know 28 The "test" command, as well as the "[" command, are not required to know
29 the "==" operator. Only a few implementations like bash and some 29 the "==" operator. Only a few implementations like bash and some
30 versions of ksh support it. 30 versions of ksh support it.
31 31
32 When you run "test foo == foo" on a platform that does not support the 32 When you run "test foo == foo" on a platform that does not support the
33 "==" operator, the result will be "false" instead of "true". This can 33 "==" operator, the result will be "false" instead of "true". This can
34 lead to unexpected behavior. 34 lead to unexpected behavior.
35 35
36files/testdata/random:7:1: $RANDOM: $RANDOM 36files/testdata/random:7:1: $RANDOM: $RANDOM
37 37
38 The variable $RANDOM is not required for a POSIX-conforming shell, and 38 The variable $RANDOM is not required for a POSIX-conforming shell, and
39 many implementations of /bin/sh do not support it. It should therefore 39 many implementations of /bin/sh do not support it. It should therefore
40 not be used in shell programs that are meant to be portable across a 40 not be used in shell programs that are meant to be portable across a
41 large number of POSIX-like systems. 41 large number of POSIX-like systems.
42 42
43files/testdata/test-eqeq:7:7: found test ... == ...: test a == b # bad 43files/testdata/test-eqeq:7:8: found test ... == ...: test a == b # bad
44files/testdata/test-eqeq:10:4: found test ... == ...: [ a == b ] # bad 44files/testdata/test-eqeq:10:5: found test ... == ...: [ a == b ] # bad
45files/testdata/test-eqeq:14:4: found test ... == ...: [ a == b -a c == d ] 45files/testdata/test-eqeq:14:5: found test ... == ...: [ a == b -a c == d ]