X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95F873858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1711872720; bh=cf2uOqzz4svzHvMb9nDNnJ0745+Nylk3/49yztBZe4I=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=q2RAMc64fj7SHN3htr+5vIMdSxt4xGBWJTexbFmmPD4JGCaPTWdisfUaDAuBOKBp6 a62LcmGYPQvoArBRW9a8fxvzcJYpNpkv31x9di9gBt3kom2esWtR1AEJttjUCJdpqG Y+I31fL4W30odxFZikcCq69f8cysTY/Iwv2nb7lM= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A78B73858D39 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A78B73858D39 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 Subject: util-linux-2.39.3-1: libblkid returns invalid physical_sector_size To: cygwin AT cygwin DOT 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 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 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Christian Franke via Cygwin Reply-To: Christian Franke Content-Type: text/plain; charset="utf-8"; Format="flowed" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 42V8C2s7864849 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple