From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 16 16:11:45 2023 Received: (at submit) by debbugs.gnu.org; 16 Apr 2023 20:11:45 +0000 Received: from localhost ([127.0.0.1]:52576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1po8it-0002VK-QE for submit@debbugs.gnu.org; Sun, 16 Apr 2023 16:11:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:54388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1po2Ho-0001wr-Fe for submit@debbugs.gnu.org; Sun, 16 Apr 2023 09:19:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po2Ho-0005e8-8F for bug-gzip@gnu.org; Sun, 16 Apr 2023 09:19:20 -0400 Received: from baseband.digital ([162.55.218.138]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po2Hm-0000jm-GN for bug-gzip@gnu.org; Sun, 16 Apr 2023 09:19:20 -0400 Received: from [IPV6:2001:9e8:3840:3900:c317:6064:27d7:e952] (unknown [IPv6:2001:9e8:3840:3900:c317:6064:27d7:e952]) by baseband.digital (Postfix) with ESMTPSA id 1CFCA5DCB8 for ; Sun, 16 Apr 2023 15:19:13 +0200 (CEST) Message-ID: <5fb82a29-81b0-2c98-f3f0-4ee2459cba4f@hostalia.de> Date: Sun, 16 Apr 2023 15:19:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: bug-gzip@gnu.org Content-Language: en-US From: =?UTF-8?Q?Marcus_M=c3=bcller?= Subject: [bug] zless will not work when LESSSECURE is set Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=162.55.218.138; envelope-from=marcus_gnu@hostalia.de; helo=baseband.digital X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 16 Apr 2023 16:11:42 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Dear Mailing List and esp. Maintainers, as found out via investigation[1] triggered by the same bug in a different implementation of `zless`, gzip's `zless` has a bug: When you (as is generally kind of not a bad idea to do) have exported LESSSECURE=1, `less` will refuse to work with programs passed through LESSOPEN='|…' as piped-through processes. Now, that's the central working principle of `zless` [2]: |LESSOPEN="|$check_exit_status${use_input_pipe_on_stdin}gzip -cdfq -- %s"| Thus, in environments with reasonable security settings, `less` will not run `gzip`, hence will tell the user that "input is a binary file" and try to display the compressed original file. I'd blame `less` a tiny bit for not even informing the user about things being ignored, but then again, it's how its always worked. So, to the unsuspecting user export LESSSECURE=1 # often done in /etc/profile or similar place echo "Hello World" > helloworld.txt gzip helloworld.txt zless helloworld.txt.gz will result in "helloworld.txt.gz" may be a binary file. See it anyway? y ^_<8B>^H^H<8A>;d^@^Chelloworld.txt^@HW^B^@R[|^H^@^@^@ helloworld.txt.gz (END) Best regards, Marcus [1] https://unix.stackexchange.com/questions/743049/issue-viewing-compressed-file-with-zless-but-not-with-zmore-or-gunzip-c#comment1412495_743050+ [2] https://git.savannah.gnu.org/cgit/gzip.git/tree/zless.in#n77