NetBSD Problem Report #59526

From jschauma@netmeister.org  Sat Jul 12 19:37:39 2025
Return-Path: <jschauma@netmeister.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A75191A923E
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 12 Jul 2025 19:37:39 +0000 (UTC)
Message-Id: <20250712193123.CCD69A1085@panix.netmeister.org>
Date: Sat, 12 Jul 2025 15:31:23 -0400 (EDT)
From: jschauma@netmeister.org
Reply-To: jschauma@netmeister.org
To: gnats-bugs@NetBSD.org
Subject: file(1) reports "lhs/off overflow" for gz files
X-Send-Pr-Version: 3.95

>Number:         59526
>Category:       bin
>Synopsis:       file(1) reports "lhs/off overflow" for gz files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 12 19:40:00 +0000 2025
>Last-Modified:  Sun Jul 13 01:20:00 +0000 2025
>Originator:     Jan Schaumann
>Release:        NetBSD 10.1
>Organization:

>Environment:


System: NetBSD panix.netmeister.org 10.1 NetBSD 10.1 (GENERIC_PANIX) #0: Thu Dec 19 23:22:11 EST 2024 root@vc1.vc.panix.com:/usr/src/sys/arch/amd64/compile/GENERIC_PANIX amd64
Architecture: x86_64
Machine: amd64
>Description:

Since updating to NetBSD 10.1 from 9.3, file(1) started reporting "lhs/off overflow"
when run against gzipped text files.

>How-To-Repeat:

$ echo foo > /tmp/f
$ file /tmp/f
/tmp/f: ASCII text
$ gzip /tmp/f
$ file /tmp/f.gz
lhs/off overflow 3080456200 0
/tmp/f.gz: gzip compressed data, was "f", last modified: Sat Jul 12 19:26:42 2025, max compression, from Unix, truncated
$ ident `which file`
/usr/bin/file:
	$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:46 joerg Exp $
	$NetBSD: crt0-common.c,v 1.27 2022/06/21 06:52:17 skrll Exp $
	$NetBSD: crti.S,v 1.1 2010/08/07 18:01:35 joerg Exp $
	$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $
	$NetBSD: file.c,v 1.17 2022/09/24 20:21:46 christos Exp $
	$NetBSD: crtend.S,v 1.1 2010/08/07 18:01:34 joerg Exp $
	$NetBSD: crtn.S,v 1.1 2010/08/07 18:01:35 joerg Exp $
$ 

Just in case this has to do with gzip:

$ ident `which gzip`
/usr/bin/gzip:
	$NetBSD: crt0.S,v 1.4 2018/11/26 17:37:46 joerg Exp $
	$NetBSD: crt0-common.c,v 1.27 2022/06/21 06:52:17 skrll Exp $
	$NetBSD: crti.S,v 1.1 2010/08/07 18:01:35 joerg Exp $
	$NetBSD: crtbegin.S,v 1.2 2010/11/30 18:37:59 joerg Exp $
	$NetBSD: gzip.c,v 1.118.2.1 2024/02/04 11:07:40 martin Exp $
	$NetBSD: unxz.c,v 1.8.10.1 2024/10/14 18:11:35 martin Exp $
	$NetBSD: crtend.S,v 1.1 2010/08/07 18:01:34 joerg Exp $
	$NetBSD: crtn.S,v 1.1 2010/08/07 18:01:35 joerg Exp $


>Fix:


>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/59526: file(1) reports "lhs/off overflow" for gz files
Date: Sat, 12 Jul 2025 20:34:55 -0000 (UTC)

 jschauma@netmeister.org writes:

 >$ file /tmp/f.gz
 >lhs/off overflow 3080456200 0
 >/tmp/f.gz: gzip compressed data, was "f", last modified: Sat Jul 12 19:26:42 2025, max compression, from Unix, truncated

 % file /tmp/f.gz
 lhs/off overflow 3218540552 0
 /tmp/f.gz: gzip compressed data, was "f", last modified: Sat Jul 12 20:04:39 2025, from Unix, truncated

 00000000  1f 8b 08 08 d7 bf 72 68  00 03 66 00 4b cb cf e7  |......rh..f.K...|
 00000010  02 00 a8 65 32 7e 04 00  00 00                    |...e2~....|
 0000001a

 and  3218540552 = 0xbfd70808

 The number is slightly different as byte 4..7 are a 32bit UNIX time value.

 The error message comes from a pattern in the magic file that interprets
 byte 2..5 as a positive signed little-endian 32bit number. So if
 byte 5 >= 128, you see the warning from the parser.

 Pushing the date a few hours (then byte 5 is < 128) yields:

 % sudo date 07130240
 Sun Jul 13 02:40:00 CEST 2025
 gossam% echo foo > /tmp/f
 gossam% gzip /tmp/f
 /tmp/f.gz already exists -- do you wish to overwrite (y or n)? y
 gossam% file /tmp/f.gz
 /tmp/f.gz: gzip compressed data, was "f", last modified: Sun Jul 13 00:40:08 2025, from Unix, truncated


 The version of file(1) in NetBSD-current has fixed this and additionally
 will print the warning only in debug mode.

From: Sean Cole <scole@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/59526: file(1) reports "lhs/off overflow" for gz files
Date: Sat, 12 Jul 2025 18:16:13 -0700

 I reported this earlier https://gnats.netbsd.org/57738 but I don't think
 it was ever properly fixed, at least in a stable branch.

 It's still happening for me with 10.1_STABLE amd64 as well.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.