Bug#846465: most: Add support for XZ-compressed files

2016-12-14 Thread Benj. Mako Hill

> > Fortunately it seems very easy to do, so I'm attaching the patch.
> 
> I pressed the 'send' button too fast. The previous patch was wrong,
> here's the correct one.

Thanks for this! I really appreciate the help.

I've applied this patch to a version I've just uploaded to Debian
unstable. It also fixes the other security you've mentioned and I've
emailed the security team so we can begin fixing that issue in
distributions other than testing/unstable.

Thanks for your work on this!

Later,
Mako


-- 
Benjamin Mako Hill
http://mako.cc/

Creativity can be a social contribution, but only in so far
as society is free to use the results. --GNU Manifesto


signature.asc
Description: PGP signature


Bug#846465: most: Add support for XZ-compressed files

2016-12-01 Thread Alberto Garcia
On Thu, Dec 01, 2016 at 11:54:09AM +0200, Alberto Garcia wrote:

> Fortunately it seems very easy to do, so I'm attaching the patch.

I pressed the 'send' button too fast. The previous patch was wrong,
here's the correct one.

Berto
From: Alberto Garcia 
Subject: Add support for XZ-compressed files
Index: most-5.0.0a/src/file.c
===
--- most-5.0.0a.orig/src/file.c
+++ most-5.0.0a/src/file.c
@@ -120,6 +120,13 @@ static int open_compressed_file(char *fi
 	  {
 	 cmd = MOST_LZMA_POPEN_FORMAT;
 	  }
+	else if ((buf[0] == (char) 0xfd)
+	&& (buf[1] == '7') && (buf[2] == 'z')
+	&& (buf[3] == 'X') && (buf[4] == 'Z')
+	&& (buf[5] == (char) 0x00))
+	  {
+	 cmd = MOST_XZ_POPEN_FORMAT;
+	  }
 	
 	if (cmd != NULL)
 	  {
Index: most-5.0.0a/src/file.h
===
--- most-5.0.0a.orig/src/file.h
+++ most-5.0.0a/src/file.h
@@ -23,6 +23,7 @@
 #define MOST_GUNZIP_POPEN_FORMAT "gzip -dc \"%s\""
 #define MOST_BZIP2_POPEN_FORMAT "bzip2 -dc \"%s\""
 #define MOST_LZMA_POPEN_FORMAT "lzma -dc '%s'"
+#define MOST_XZ_POPEN_FORMAT "xz -dc \"%s\""
 
 extern void most_reread_file (void);
 extern void most_read_to_line (int);


Bug#846465: most: Add support for XZ-compressed files

2016-12-01 Thread Alberto Garcia
Package: most
Version: 5.0.0a-2.5
Severity: wishlist
Tags: patch

Hey,

Now that the XZ compression format is becoming increasingly common it
would be awesome to add transparent descompression support to most.

Fortunately it seems very easy to do, so I'm attaching the patch.

Regards,

Berto

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages most depends on:
ii  libc6  2.24-5
ii  libslang2  2.3.0-4.1

most recommends no packages.

most suggests no packages.

-- no debconf information
From: Alberto Garcia 
Subject: Add support for XZ-compressed files
Index: most-5.0.0a/src/file.c
===
--- most-5.0.0a.orig/src/file.c
+++ most-5.0.0a/src/file.c
@@ -120,6 +120,13 @@ static int open_compressed_file(char *fi
 	  {
 	 cmd = MOST_LZMA_POPEN_FORMAT;
 	  }
+	else if ((buf[0] == (char) 0xfd)
+	&& (buf[1] == '7') && (buf[2] == 'z')
+	&& (buf[3] == 'X') && (buf[4] == 'Z')
+	&& (buf[5] == (char) 0x00))
+	  {
+	 cmd = MOST_XZ_POPEN_FORMAT;
+	  }
 	
 	if (cmd != NULL)
 	  {
Index: most-5.0.0a/src/file.h
===
--- most-5.0.0a.orig/src/file.h
+++ most-5.0.0a/src/file.h
@@ -23,6 +23,7 @@
 #define MOST_GUNZIP_POPEN_FORMAT "gzip -dc \"%s\""
 #define MOST_BZIP2_POPEN_FORMAT "bzip2 -dc \"%s\""
 #define MOST_LZMA_POPEN_FORMAT "lzma -dc '%s'"
+#define MOST_XZ_POPEN_FORMAT "xz -dc '%s'"
 
 extern void most_reread_file (void);
 extern void most_read_to_line (int);