From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout10.t-online.de (mailout10.t-online.de [194.25.134.21]) by sourceware.org (Postfix) with ESMTPS id A78B73858D39 for ; Sun, 31 Mar 2024 08:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A78B73858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=t-online.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A78B73858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=194.25.134.21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711872692; cv=none; b=ekApJzb44+IXqnyXoESUN+T2OQ08FKEFhMHZOKc8jZwVsC5JGlK85wQ8YHmyzEmtUXbfKOo0iavRVFAc4PGDbPPn74ywLV8FAqb/UL7iHfEXsRfU96+EXRTemPI8Fg/ghPrfprkkv7/0txV4RMmYpseQjiwiOPYPSJkHuoxaNwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711872692; c=relaxed/simple; bh=+/fd2o+57nHLPMutPRX0PBnu2VXHbK/dYfHhol5r8wY=; h=From:Subject:To:Message-ID:Date:MIME-Version; b=n/Twd0mdJysEAoKHPMyzBmMG2BwtmqwHb8CngNweVQS81ipwtAyl5Nnu4+fr0VUfTcBdisDvnhmYLABeSBKnDTYx8RT8+0rVVZhf2V+HLQ4m6aNVlxOv4CU0OegdMdc7JZnXGkxBLSoAW31EvheSpu0r1VVH3Z3ZIx9vbuNZoug= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fwd72.aul.t-online.de (fwd72.aul.t-online.de [10.223.144.98]) by mailout10.t-online.de (Postfix) with SMTP id EB40B4C2C9 for ; Sun, 31 Mar 2024 10:11:27 +0200 (CEST) Received: from [192.168.2.101] ([79.230.172.235]) by fwd72.t-online.de with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted) esmtp id 1rqqHk-0ZZ5Bg0; Sun, 31 Mar 2024 10:11:24 +0200 From: Christian Franke Subject: util-linux-2.39.3-1: libblkid returns invalid physical_sector_size To: cygwin@cygwin.com Message-ID: <0fb74540-3878-206d-b623-15437fe79b01@t-online.de> Date: Sun, 31 Mar 2024 10:11:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TOI-EXPURGATEID: 150726::1711872684-2F7FD94C-22CC962E/0/0 CLEAN NORMAL X-TOI-MSGID: 78210ddf-872b-42a3-b1ce-9bd22b1bf581 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FROM,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Testcase: # cygcheck -f /sbin/fdisk.exe util-linux-2.39.3-1 # /sbin/fdisk.exe -l /dev/sdd Disk /dev/sdd: 465.76 GiB, 500107862016 bytes, 976773168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 34359738880 bytes I/O size (minimum/optimal): 34359738880 bytes / 34359738880 bytes Disklabel type: dos Disk identifier: 0x0ac1a23 Device     Boot Start       End   Sectors   Size Id Type /dev/sdd1        2048 976769023 976766976 465.8G  7 HPFS/NTFS/exFAT Partition 1 does not start on physical sector boundary. # printf '0x%016x\n' 34359738880 0x0000000800000200 The problem is that libblkid expects the results of BLKIOMIN, BLKIOOPT and BLKPBSZGET as 64 bit 'unsigned long' but Cygwin only returns 32 bit 'int': - util-linux-2.39.3/libblkid/src/topology/ioctl.c: ... static const struct topology_val {     long  ioc;     /* functions to set probing result */     int (*set_ulong)(blkid_probe, unsigned long);     int (*set_int)(blkid_probe, int);     int (*set_u64)(blkid_probe, uint64_t); } topology_vals[] = {     { BLKALIGNOFF, NULL, blkid_topology_set_alignment_offset },     { BLKIOMIN, blkid_topology_set_minimum_io_size },     { BLKIOOPT, blkid_topology_set_optimal_io_size },     { BLKPBSZGET, blkid_topology_set_physical_sector_size }, #ifdef BLKGETDISKSEQ     { BLKGETDISKSEQ, .set_u64 = blkid_topology_set_diskseq }, #endif     /* we read BLKSSZGET in topology.c */ }; ... - util-linux-2.39.3/libblkid/src/topology/topology.c: ... struct blkid_struct_topology {     unsigned long    alignment_offset;     unsigned long    minimum_io_size;     unsigned long    optimal_io_size;     unsigned long    logical_sector_size;     unsigned long    physical_sector_size;     unsigned long   dax;     uint64_t    diskseq; }; ... int blkid_topology_set_physical_sector_size(blkid_probe pr, unsigned long val) ... - newlib-cygwin/winsup/cygwin/fhandler/floppy.cc: ...     case BLKIOMIN:       debug_printf ("BLKIOMIN");       *(int *)buf = (int) bytes_per_sector;       break;     case BLKIOOPT:       debug_printf ("BLKIOOPT");       *(int *)buf = (int) bytes_per_sector;       break;     case BLKPBSZGET:       debug_printf ("BLKPBSZGET");       *(int *)buf = (int) bytes_per_sector;       break; ... A quick fix which only works on LE platforms: - util-linux-2.39.3/libblkid/src/topology/ioctl.c: ... static int probe_ioctl_tp(blkid_probe pr, ...         union {             unsigned long ul;             int i;             uint64_t u64; -        } data; +        } data = { 0 }; ... Downgrading to util-linux-2.33.3-3 does not help. The related code differs, but has the same problem. The fdisk variant in busybox-1.36.1-2 is not affected. -- Regards, Christian