From e930dd2b0b82d133176e93a6a9855ac2a2d367c8 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 23 Dec 2023 01:54:26 -0500 Subject: Update NEWS; sbolint: check for CRLF in *.diff, *.patch. --- NEWS | 16 +++++++++++++++- sbolint | 31 +++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e9896f1..ae050ea 100644 --- a/NEWS +++ b/NEWS @@ -10,16 +10,30 @@ sbopkglint: - ELF objects aren't checked for ARCH, if they're in /usr/share/qemu. - perllocal.pod, .packlist, *.bs are detected. - Invalid characters in the package name are detected. +- /usr/share/terminfo structure and contents are now checked. +- Don't suggest noarch, if the package contains static libraries. +- Support aarch64 static lib checking. +- Images in /usr/share/pixmaps are only checked if they're directly + in the directory; contents of /usr/share/pixmaps/*/ aren't checked. +- If doinst.sh contains hardcoded $PKG, mention doinst.sh in the message. + Previously, it just said /var/lib/pkgtools/scripts/$PRGNAM, which is + where doinst.sh gets moved to after package install. sbolint: - *.rej files are detected and draw a warning. - Script permission check allows 0644 or 0755 now. - URLs in .info files with % characters are now handled correctly. +- Files named *.diff and *.patch are checked; if they have DOS-style + CRLF line endings, that's an error, and the message suggests + gzipping the file. This is needed because SBo's git repo will + "helpfully" strip the carriage returns (so your submission tarball + is correct, but after it's approved *everyone else* get a bad patch + file). sbodl: - Don't refer to itself as sbopkglint in --help and man page. - Add -n (--no-content-disposition) option, and make option - processing nicer. + processing nicer (long options and bundling). New in 0.9.0: ============= diff --git a/sbolint b/sbolint index 2d69b74..bb7355b 100755 --- a/sbolint +++ b/sbolint @@ -291,6 +291,22 @@ cache must be checked before this command is run. =back +=item - + +Image files are checked for permissions (0644), filename (extension +must match filetype, e.g. a GIF image must not be named image.jpg), +and correctness (must not be truncated/corrupt). + +=item - + +Patch files (anything named *.diff or *.patch) are checked for +permissions (0644) and DOS/Windows CRLF line endings. If a patch +file has CRLF endings, it B be checked into SBo's repository, +because git will strip the CR (\r) from every line, meaning the patch +will fail to apply. In this case, the best solution is to gzip the +patch, and have the SlackBuild use e.g. "zcat $CWD/blah.diff.gz | +patch -p1" to apply it. + =back =head1 EXIT STATUS @@ -721,6 +737,7 @@ sub run_checks { \&check_script, \&check_doinst, \&check_images, + \&check_patches, \&check_empty_hidden, ); @@ -785,7 +802,14 @@ sub check_and_read { } } - log_error("$file has DOS-style CRLF line endings") if $crlf_err; + if($crlf_err) { + if($file =~ /\.(diff|patch)$/i) { + log_error("$file has DOS-style CRLF line endings, git will mess it up unless you gzip it!") if $crlf_err; + } else { + log_error("$file has DOS-style CRLF line endings") if $crlf_err; + } + } + log_error("$file has no newline at EOF") if $lastline_nonl; return @lines; } @@ -1738,8 +1762,11 @@ sub check_junkfiles { # if anything *.diff or *.patch contains \r, warn the # user about git stripping the \r's (better gzip it). +# 20231223 bkw: this check relies on check_and_read special-casing +# filenames ending in *.diff or *.patch. sub check_patches { - for(<*.diff>,<*.patch>) { + my $patches = `find . \\( -iname '*.diff' -o -iname '*.patch' \\) -print0`; + for(split /\x00/, $patches) { check_and_read($_, 0644); } } -- cgit v1.2.3