summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-02 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2019-10-02 03:01:29 +0000
commitd94b7a8c132734a1bc4046d54a75c7882c4c2619 (patch)
tree7326afd537da7739f5e5127da75d0766835e3c3e /support
parent31d84cec65917cfc6ef446f1bf6031cff7c6dc7b (diff)
CTAN sync 201910020301
Diffstat (limited to 'support')
-rw-r--r--support/pkgcheck/CHANGES.md10
-rw-r--r--support/pkgcheck/Cargo.toml5
-rwxr-xr-xsupport/pkgcheck/bin/pkgcheckbin7436104 -> 7927624 bytes
-rw-r--r--support/pkgcheck/docs/pkgcheck.pdfbin62946 -> 65641 bytes
-rw-r--r--support/pkgcheck/docs/title.tex2
-rw-r--r--support/pkgcheck/docs/warningsd.tex16
-rw-r--r--support/pkgcheck/src/main.rs40
-rw-r--r--support/pkgcheck/src/messages/mod.rs28
-rw-r--r--support/pkgcheck/src/messages/warningsd.rs22
9 files changed, 108 insertions, 15 deletions
diff --git a/support/pkgcheck/CHANGES.md b/support/pkgcheck/CHANGES.md
index 912a2e8aaf..084a17581a 100644
--- a/support/pkgcheck/CHANGES.md
+++ b/support/pkgcheck/CHANGES.md
@@ -56,7 +56,15 @@
- correct typo in e0008 message text
2019-08-07 (1.8.2)
- updating crates, requiring slight code changes in integration.rs
- - ignore windows files .nsh and .reg when checking for CRLF line endings
+ - ignore windows files .nsh and .reg when checking for LF line endings
- new error message e0034 for unwanted files in top level directory of a TDS zip archive
- e0020 now reporting only unwanted directory in top level directory of a TDS zip archive
+2019-10-01 (1.8.3)
+ - (Experimental) issue warning if a file in the package tree (W0005) or in the TDS zip archive (W0006) is
+ larger than 40MiB
+ - (Experimental) for babel-base.tds.zip use the real package name 'babel' (instead of 'babel-base') in order
+ to check if the path name contains the package name
+
+ Both features are regarded as experimental because both contain a hard coded check. If required
+ things will be changed in the future.
diff --git a/support/pkgcheck/Cargo.toml b/support/pkgcheck/Cargo.toml
index 74b14f05cc..b682eec3e8 100644
--- a/support/pkgcheck/Cargo.toml
+++ b/support/pkgcheck/Cargo.toml
@@ -1,13 +1,13 @@
[package]
name = "pkgcheck"
-version = "1.8.2"
+version = "1.8.3"
authors = ["Manfred Lotz <manfred@ctan.org>"]
description = "Command-line tool to check packages uploaded to CTAN."
license = "MIT/Apache-2.0"
edition = "2018"
[dependencies]
-structopt = "0.2"
+structopt = "0.3"
walkdir = "2.2"
scoped_threadpool = "0.1"
num_cpus = "1"
@@ -31,5 +31,4 @@ escargot = "0.5"
threadpool = "1.7.1"
unicode-bom = "1"
-
url = "2.1"
diff --git a/support/pkgcheck/bin/pkgcheck b/support/pkgcheck/bin/pkgcheck
index aedf999a10..09397b1a1a 100755
--- a/support/pkgcheck/bin/pkgcheck
+++ b/support/pkgcheck/bin/pkgcheck
Binary files differ
diff --git a/support/pkgcheck/docs/pkgcheck.pdf b/support/pkgcheck/docs/pkgcheck.pdf
index 23e52fafe3..d8c8a02bc9 100644
--- a/support/pkgcheck/docs/pkgcheck.pdf
+++ b/support/pkgcheck/docs/pkgcheck.pdf
Binary files differ
diff --git a/support/pkgcheck/docs/title.tex b/support/pkgcheck/docs/title.tex
index f13bf6193c..0955e7d594 100644
--- a/support/pkgcheck/docs/title.tex
+++ b/support/pkgcheck/docs/title.tex
@@ -1 +1 @@
-\title{pkgcheck Utility, v1.8.2}
+\title{pkgcheck Utility, v1.8.3}
diff --git a/support/pkgcheck/docs/warningsd.tex b/support/pkgcheck/docs/warningsd.tex
index 7b8c676e23..7189f196e1 100644
--- a/support/pkgcheck/docs/warningsd.tex
+++ b/support/pkgcheck/docs/warningsd.tex
@@ -37,3 +37,19 @@ we issues a warning.
Nevertheless, the CTAN team discourages uses of BOM. Please be aware,
that in some future time this could be reagarded as an error.
+
+\hypertarget{w0005----very-large-file--with-size-size-detected-in-package}{%
+\subsection{\texorpdfstring{W0005 -\/- Very large file with size
+\texttt{\textless{}size\textgreater{}} detected in
+package}{W0005 -\/- Very large file with size \textless size\textgreater{} detected in package}}\label{w0005----very-large-file--with-size-size-detected-in-package}}
+
+(Experimental) We issue the message if there is a file is larger than
+40MiB in the package directory tree.
+
+\hypertarget{w0006----very-large-file-with-size-size-detected-in-tds-zip-archive}{%
+\subsection{\texorpdfstring{W0006 -\/- Very large file with size
+\texttt{\textless{}size\textgreater{}} detected in TDS zip
+archive}{W0006 -\/- Very large file with size \textless size\textgreater{} detected in TDS zip archive}}\label{w0006----very-large-file-with-size-size-detected-in-tds-zip-archive}}
+
+(Experimental) We issue the message if there is a file larger than 40MiB
+in the TDS zip archive.
diff --git a/support/pkgcheck/src/main.rs b/support/pkgcheck/src/main.rs
index a7be277330..c69423252d 100644
--- a/support/pkgcheck/src/main.rs
+++ b/support/pkgcheck/src/main.rs
@@ -103,17 +103,17 @@ fn filename_has_bad_chars(entry: &DirEntry) -> Option<(usize, char)> {
for (i, c) in s.char_indices() {
match c {
- '\x00'...'\x1f' => return Some((i, c)),
+ '\x00'..='\x1f' => return Some((i, c)),
' ' | '!' | '"' | '#' | '$' | '%' | '&' | '\'' => return Some((i, c)),
'(' | ')' | '*' => return Some((i, c)),
'+' | ',' | '-' | '.' => (),
- '0'...'9' => (),
+ '0'..='9' => (),
':' | ';' | '<' | '=' | '>' | '?' | '@' => return Some((i, c)),
- 'A'...'Z' => (),
+ 'A'..='Z' => (),
'[' | '\\' | ']' | '^' => return Some((i, c)),
'_' => (),
'`' => return Some((i, c)),
- 'a'...'z' => (),
+ 'a'..='z' => (),
'{' | '|' | '}' | '~' => return Some((i, c)),
'/' => return None,
_ => return Some((i, c)),
@@ -519,7 +519,6 @@ fn check_generated_files(entry: &str, generated: &mut HashMap<PathBuf, PathBuf>)
}
Err(e) => println!("Error opening file {}: {:?}", entry, e),
}
- return;
}
fn x_bit_set(p: u32) -> bool {
@@ -582,6 +581,19 @@ fn check_tds_archive(
}
};
+ // We have a discrepancy between
+ // TDS zip archive name: babel-base.tds.zip
+ // and package name: babel
+ // which yields a false test when checking for the package name
+ // the path names of the TDS zip archive files.
+ // Therefore, we correct here.
+ let real_pkg_name = if pkg_name == "babel-base" {
+ "babel"
+ } else {
+ pkg_name
+ };
+
+
let tmp_dir = TempDir::new("pkgcheck")?;
let tmp_dir_offset = tmp_dir.path().to_str().unwrap().len() + 1;
unzip_tds_archive(tds_zip, tmp_dir.path().to_str().unwrap());
@@ -682,13 +694,16 @@ fn check_tds_archive(
if is_temporary_file(&dir_entry_str) {
e0008!(dir_entry_display);
}
+ if fsize > 40 * 1024 * 1024 {
+ w0006!(dir_entry_display, fsize / 1024 / 1024);
+ }
// if the path doesn't contain a man page...
if dir_entry_str.find("/man/").is_none() {
- let pkg_name_s = format!("/{}/", pkg_name);
+ let pkg_name_s = format!("/{}/", real_pkg_name);
// ...then we want to have the package name in the path
if dir_entry_str.find(&pkg_name_s).is_none() {
- e0028!(pkg_name, dir_entry_display);
+ e0028!(real_pkg_name, dir_entry_display);
}
}
@@ -833,8 +848,8 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<Hashes> {
i0002!(root);
// This hash contains all package file names.
- //
- // PathBuf: the full path starting at the directory specified at the command line
+ //
+ // PathBuf: the full path starting at the directory specified at the command line
// Metadata: the meta data of the file
// String: the file name without any directory part
// ReadmeKind: is it a certain README, file or symlink?
@@ -871,7 +886,7 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<Hashes> {
continue;
}
- // this is the file_name without the directory part
+ // this is the file_name without the directory part
// unwrap() is ok here as we covered potential UTF-8 related errors
// above in the definition of dir_entry_str
let file_name = dir_entry.file_name().to_str().unwrap().to_string();
@@ -992,6 +1007,7 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<Hashes> {
.push(PathBuf::from(dir_entry_str));
}
+ // detecting large files in package directory
if is_readme(&dir_entry) {
// We want to deal with README files only if they are
@@ -1084,6 +1100,10 @@ fn check_package(root: &str, tds_zip: &Option<String>) -> Option<Hashes> {
e0005!(dir_entry_str);
continue;
}
+ if fsize > 40 * 1024 * 1024 {
+ w0005!(dir_entry_str, fsize / 1024 / 1024);
+ continue;
+ }
let p = get_perms(&path);
if !owner_has(p, 4) {
diff --git a/support/pkgcheck/src/messages/mod.rs b/support/pkgcheck/src/messages/mod.rs
index c63b6e2cec..0a77e14c1e 100644
--- a/support/pkgcheck/src/messages/mod.rs
+++ b/support/pkgcheck/src/messages/mod.rs
@@ -476,6 +476,30 @@ macro_rules! w0004 {
};
}
+macro_rules! w0005 {
+ ($fmt1:expr, $fmt2:expr) => {
+ error_occured!();
+ print!(
+ "{} Very large file {} with size {}MiB detected\n",
+ msgid!("W0005"),
+ $fmt1,
+ $fmt2
+ );
+ };
+}
+
+macro_rules! w0006 {
+ ($fmt1:expr, $fmt2:expr) => {
+ error_occured!();
+ print!(
+ "{} Very large file {} with size {}MiB detected in TDS zip archive\n",
+ msgid!("W0006"),
+ $fmt1,
+ $fmt2
+ );
+ };
+}
+
macro_rules! i0002 {
($fmt:expr) => {
print!(
@@ -593,6 +617,8 @@ pub fn explains(err: &str) {
"W0002" => w0002d(),
"W0003" => w0003d(),
"W0004" => w0004d(),
+ "W0005" => w0005d(),
+ "W0006" => w0006d(),
e => println!(
"F0006 Unknown error code `{}` specified with option -e resp. --explain. Exiting...",
@@ -654,4 +680,6 @@ pub fn explains_all() {
explains("W0002");
explains("W0003");
explains("W0004");
+ explains("W0005");
+ explains("W0006");
}
diff --git a/support/pkgcheck/src/messages/warningsd.rs b/support/pkgcheck/src/messages/warningsd.rs
index 588144968d..b8a1aa8ef3 100644
--- a/support/pkgcheck/src/messages/warningsd.rs
+++ b/support/pkgcheck/src/messages/warningsd.rs
@@ -56,3 +56,25 @@ that in some future time this could be reagarded as an error.
)
}
+pub fn w0005d() {
+ println!(
+ r#"
+W0005 -- Very large file with size <size> detected in package
+
+(Experimental) We issue the message if there is a file is larger than
+40MiB in the package directory tree.
+"#
+ )
+}
+
+pub fn w0006d() {
+ println!(
+ r#"
+W0006 -- Very large file with size <size> detected in TDS zip archive
+
+(Experimental) We issue the message if there is a file larger than 40MiB
+in the TDS zip archive.
+"#
+ )
+}
+