source@mandoc.bsd.lv
 help / color / Atom feed
* cvsweb: The tar(1) -z option is fully portable: all BSDs, GNU tar, and 
@ 2019-11-29 14:30 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-11-29 14:30 UTC (permalink / raw)
  To: source

Log Message:
-----------
The tar(1) -z option is fully portable: all BSDs, GNU tar, and Illumos
support it.  Consequently, there is no need to run tar(1) and gzip(1)
in a pipe.

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

Revision Data
-------------
Index: cvsweb.cgi
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.cgi,v
retrieving revision 4.29
retrieving revision 4.30
diff -Lcvsweb.cgi -Lcvsweb.cgi -u -p -r4.29 -r4.30
--- cvsweb.cgi
+++ cvsweb.cgi
@@ -78,7 +78,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 @cvs_options
+  $allow_tar @tar_options @cvs_options
   @annotate_options @rcsdiff_options
   $HTML_DOCTYPE $HTML_META $cssurl $CSS
 );
@@ -128,7 +128,7 @@ EOM
   $MimeTypes = undef if $@;
 
   $CheckoutMagic = '~checkout~';
-  $CMD{$_} = "/usr/bin/$_" for (qw(cvs gzip rcsdiff rlog));
+  $CMD{$_} = "/usr/bin/$_" for (qw(cvs rcsdiff rlog));
   $CMD{tar} = "/bin/tar";
 }
 
@@ -678,22 +678,13 @@ if ($input{tarball}) {
       ('500 Internal Error',
        'Export failure (exit status %s), output: <pre>%s</pre>',
        $errcode, $err || $export_err);
-
   } else {
-
     $| = 1;    # Essential to get the buffering right.
     local (*TAR_OUT);
-
-    my (@cmd, $ctype);
-      my @tar = ($CMD{tar}, @tar_options, '-cf', '-', $basedir);
-      my @gzip = ($CMD{gzip}, @gzip_options, '-c');
-      push(@cmd, \@tar, '|', \@gzip);
-      $ctype = 'application/x-gzip';
-    push(@cmd, '>pipe', \*TAR_OUT);
-
-    my ($h, $err) = startproc(@cmd);
+    my ($h, $err) = startproc($CMD{tar}, @tar_options, '-czf', '-',
+      $basedir, '>pipe', \*TAR_OUT);
     if ($h) {
-      print "Content-Type: $ctype\r\n\r\n";
+      print "Content-Type: application/x-gzip\r\n\r\n";
       local $/ = undef;
       print <TAR_OUT>;
       $h->finish();
Index: cvsweb.conf
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.conf,v
retrieving revision 4.17
retrieving revision 4.18
diff -Lcvsweb.conf -Lcvsweb.conf -u -p -r4.17 -r4.18
--- cvsweb.conf
+++ cvsweb.conf
@@ -405,9 +405,9 @@ $use_moddate = 1;
 # 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 and gzip options below.
+# CVSROOT/val-tags.  See also the tar options below.
 #
-#$allow_tar = ($CMD{tar} && $CMD{gzip}) ? 1 : 0;
+$allow_tar = 0;
 
 # Options to pass to tar(1).
 # For example: @tar_options = qw(--ignore-failed-read);
@@ -416,13 +416,6 @@ $use_moddate = 1;
 # the tar(1) (or gtar(1)) manpage for details.
 #
 @tar_options = qw();
-
-# Options to pass to gzip(1) when compressing a tarball to download.
-# For example: @gzip_options = qw(-3);
-# Try lower compression level than 6 (default) if you want faster
-# compression, or higher for better compression.
-#
-@gzip_options = qw();
 
 # 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-29 14:30 cvsweb: The tar(1) -z option is fully portable: all BSDs, GNU tar, and 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