source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: cvsweb: The tar(1) -z option is fully portable: all BSDs, GNU tar, and
Date: Fri, 29 Nov 2019 09:30:18 -0500 (EST)	[thread overview]
Message-ID: <8d079a2dcdc1e2a0@mandoc.bsd.lv> (raw)

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

                 reply	other threads:[~2019-11-29 14:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d079a2dcdc1e2a0@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).