source@mandoc.bsd.lv
 help / color / Atom feed
* cvsweb: Delete support for the pointless zip(1) format; this is Unix.
@ 2019-11-26 11:53 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-11-26 11:53 UTC (permalink / raw)
  To: source

Log Message:
-----------
Delete support for the pointless zip(1) format; this is Unix.

Modified Files:
--------------
    cvsweb:
        TODO
        cvsweb.cgi
        cvsweb.conf

Revision Data
-------------
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/TODO,v
retrieving revision 4.3
retrieving revision 4.4
diff -LTODO -LTODO -u -p -r4.3 -r4.4
--- TODO
+++ TODO
@@ -11,9 +11,7 @@ o Ensure that fatal error messages are s
 
 o Use specialized modules from CPAN to do stuff, maybe these would be useful:
   + Archive::Tar
-  + Archive::Zip
   + Compress::Zlib
-  + Compress::Bzip2
   + HTML::Entities
   + Cvs or VCS::LibCVS
 
Index: cvsweb.cgi
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.cgi,v
retrieving revision 4.24
retrieving revision 4.25
diff -Lcvsweb.cgi -Lcvsweb.cgi -u -p -r4.24 -r4.25
--- cvsweb.cgi
+++ cvsweb.cgi
@@ -79,7 +79,7 @@ use vars qw (
   $tabstop $state $annTable $sel @ForbiddenFiles
   $use_descriptions %descriptions $dwhere
   $use_moddate $gzip_open $file_list_len
-  $allow_tar @tar_options @gzip_options @zip_options @cvs_options
+  $allow_tar @tar_options @gzip_options @cvs_options
   @annotate_options @rcsdiff_options
   $HTML_DOCTYPE $HTML_META $cssurl $CSS
 );
@@ -650,7 +650,7 @@ if ($input{tarball}) {
 
   my ($module)  =  ($where =~ m,^/?(.*),);    # untaint
   $module       =~ s,/([^/]*)$,,;
-  my ($ext)     =  ($1 =~ /(\.t(?:ar\.)?gz|\.zip)$/);
+  my ($ext)     =  ($1 =~ /(\.t(?:ar\.)?gz)$/);
   my ($basedir) =  ($module =~ m,([^/]+)$,);
 
   if ($basedir eq '' || $module eq '') {
@@ -658,16 +658,11 @@ if ($input{tarball}) {
           'You cannot download the top level directory.');
   }
 
-  my $istar = ($ext eq '.tar.gz' || $ext eq '.tgz');
+  my $istar = $ext eq '.tar.gz' || $ext eq '.tgz';
   if ($istar) {
     fatal('500 Internal Error', 'tar command not found.') unless $CMD{tar};
     fatal('500 Internal Error', 'gzip command not found.') unless $CMD{gzip};
-  }
-  my $iszip = ($ext eq '.zip');
-  if ($iszip && !$CMD{zip}) {
-    fatal('500 Internal Error', 'zip command not found.');
-  }
-  if (!$istar && !$iszip) {
+  } else {
     fatal('500 Internal Error', 'Unsupported archive type.');
   }
 
@@ -712,10 +707,6 @@ if ($input{tarball}) {
       my @gzip = ($CMD{gzip}, @gzip_options, '-c');
       push(@cmd, \@tar, '|', \@gzip);
       $ctype = 'application/x-gzip';
-    } elsif ($iszip) {
-      my @zip = ($CMD{zip}, @zip_options, '-r', '-', $basedir);
-      push(@cmd, \@zip, \'');
-      $ctype = 'application/zip';
     }
     push(@cmd, '>pipe', \*TAR_OUT);
 
@@ -727,8 +718,8 @@ if ($input{tarball}) {
       $h->finish();
     } else {
       @fatal = ('500 Internal Error',
-                '%s failure (exit status %s), output: <pre>%s</pre>',
-                $istar ? 'Tar' : 'Zip', $? >> 8 || -1, $err);
+                'tar failure (exit status %s), output: <pre>%s</pre>',
+                $? >> 8 || -1, $err);
     }
   }
 
@@ -1120,17 +1111,14 @@ EOF
   if ($allow_tar && $filesfound) {
     my ($basefile) = ($where =~ m,(?:.*/)?([^/]+),);
     my $havetar = $CMD{tar} && $CMD{gzip};
-    my $havezip = $CMD{zip};
-    if (defined($basefile) && $basefile ne '' && ($havetar || $havezip)) {
+    if (defined($basefile) && $basefile ne '' && $havetar) {
       my $q = ($query ? "$query;" : '?') . 'tarball=1';
       print "<hr />\n",
         '<div style="text-align: center">Download this directory in ';
       # Mangle the filename so browsers show a reasonable filename to download.
-      my @types = ();
       $basefile = uri_escape($basefile);
-      push(@types, &link('tarball', "$basefile.tar.gz$q")) if $havetar;
-      push(@types, &link('zip archive', "$basefile.zip$q")) if $havezip;
-      print join(' or ', @types), "</div>\n";
+      print &link('tarball', "$basefile.tar.gz$q");
+      print "</div>\n";
     }
   }
 
Index: cvsweb.conf
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.conf,v
retrieving revision 4.12
retrieving revision 4.13
diff -Lcvsweb.conf -Lcvsweb.conf -u -p -r4.12 -r4.13
--- cvsweb.conf
+++ cvsweb.conf
@@ -19,13 +19,13 @@
 # Set the path for the following commands:
 #   cvs, rlog, rcsdiff
 #   gzip (if you enable $allow_compress)
-#   (g)tar, zip (if you enable $allow_tar)
+#   (g)tar (if you enable $allow_tar)
 #
 @command_path = qw(/bin /usr/bin /usr/local/bin);
 
 # Search the above directories for each command (prefer gtar over tar).
 #
-for (qw(cvs rlog rcsdiff gzip gtar zip)) {
+for (qw(cvs rlog rcsdiff gzip gtar)) {
 	$CMD{$_} = search_path($_);
 }
 $CMD{tar}   = delete($CMD{gtar}) if $CMD{gtar};
@@ -434,13 +434,13 @@ $use_moddate = 1;
 #
 #$file_list_len = 200;
 
-# Whether to allow downloading a tarball or a zip of the current directory.
+# Whether to allow downloading a tarball of the current directory.
 # While downloading of the entire repository is disallowed, depending on
 # the directory this may take a lot of time and disk space.  For some CVS
 # versions, the user account running CVSweb needs write access to
-# CVSROOT/val-tags.  See also the tar, gzip and zip options below.
+# CVSROOT/val-tags.  See also the tar and gzip options below.
 #
-#$allow_tar = (($CMD{tar} && $CMD{gzip}) || $CMD{zip}) ? 1 : 0;
+#$allow_tar = ($CMD{tar} && $CMD{gzip}) ? 1 : 0;
 
 # Options to pass to tar(1).
 # For example: @tar_options = qw(--ignore-failed-read);
@@ -456,13 +456,6 @@ $use_moddate = 1;
 # compression, or higher for better compression.
 #
 @gzip_options = qw();
-
-# Options to pass to zip(1) when compressing a zip archive to download.
-# For example: @zip_options = qw(-3);
-# Try lower compression level than 6 (default) if you want faster
-# compression, or higher for better compression.
-#
-@zip_options = qw(-q);
 
 # Options to pass to cvs(1).
 # For cvs versions 1.11 to 1.11.6 (broken in < 1.11, removed in 1.11.7), you
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 11:53 cvsweb: Delete support for the pointless zip(1) format; this is Unix schwarze

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git