NetBSD Problem Report #55381

From tsutsui@ceres.dti.ne.jp  Fri Jun 12 18:34:23 2020
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 938B11A9219
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 12 Jun 2020 18:34:23 +0000 (UTC)
Message-Id: <202006121834.05CIYE53007398@ceres.dti.ne.jp>
Date: Sat, 13 Jun 2020 03:34:14 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: sysinst wrong size check on moving partitions forward
X-Send-Pr-Version: 3.95

>Number:         55381
>Category:       install
>Synopsis:       sysinst wrong size check on moving partitions forward
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    install-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 12 18:35:00 +0000 2020
>Closed-Date:    Sat Dec 31 06:05:42 +0000 2022
>Last-Modified:  Sat Dec 31 06:05:42 +0000 2022
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0
>Organization:
>Environment:
System: all
Architecture: all
Machine: all
>Description:
On a partition editor of sysinst, there is something wrong
in partition size check when users tries to move partitions forward.

If users change a value of "start" to move it forward
(i.e. set a smaller value than before), available
size should be "previous size + extra size by moving start"
but sysinst seems to use a size "from moved start to previous start".

>How-To-Repeat:

---

 We now have your disklabel partitions for wd0 below.  This is your last   
 chance to change them.

 Flags: (I)nstall, (N)ewfs.  Total size: 512M, free: 0B

     Start (sec)    End (sec)   Size (sec)  FS type Flag Filesystem
    ------------ ------------ ------------ -------- ---- ----------------
>a:        20546       983793       963248   4.2BSD      /
 b:       983795      1049327        65533     swap
 c:            0      1049327      1049328 Whole disk
    ------------ ------------ ------------ -------- ---- ----------------
 e: Change input units (sectors/cylinders/MB/GB)
 f: Edit name of the disk
 g: Clone external partition(s)
 h: Cancel
 x: Partition sizes ok

---

Select "a:" to change partition size:

---

 We now have your disklabel partitions for wd0 below.  This is your last   
 chance to chan+------------------------------------------------------------+
               | The current values for this partition are                  |
 Flags: (I)nsta| displayed below.                                           |
               |                                                            |
     Start (sec| Select the field you wish to change:                       |
    -----------|                                                            |
>a:        2054| a:             type : FFS                                  |
 b:       98379|>b:            start : 20546 sec                            |
 c:            | c:             size : 963248 sec                           |
    -----------| d:              end : 983794 sec                           |
 e: Change inpu| e:          install : No                                   |
 f: Edit name o| f:            newfs : No                                   |
 g: Clone exter| g:            mount : Yes                                  |
 h: Cancel     | h:    mount options :                                      |
 x: Partition s| i:      mount point : /                                    |
               | j: Change input units (sectors/cylinders/MB/GB)            |
               | k: Restore original values                                 |
               | l: Delete partition                                        |
               | m: Cancel                                                  |
               | x: OK                                                      |
               +------------------------------------------------------------+

---

Change "start" from "20546" to "0":

---

 We now have your disklabel partitions for wd0 below.  This is your last   
 chance to chan+------------------------------------------------------------+
               | The current values for this partition are                  |
 Flags: (I)nsta| displayed below.                                           |
               |                                                            |
     Start (sec| Select the field you wish to change:                       |
    -----------|                                                            |
>a:        2054| a:             type : FFS                                  |
 b:       98379|>b:            start : 20546 sec                            |
 c:            | c:             size : 963248 sec                           |
    -----------| d:              end : 983794 sec                           |
 e: C+--------------------------------------------------------------------+ |
 f: E|Special values that can be entered for the offset value:            | |
 g: C|    -1:   start at the beginning                                    | |
 h: C|   a-c:   start at the end of given partition                       | |
 x: P|     d:   start at the beginning of given free space                | |
     |                                                                    | |
     |d: Space at 0..983795 sec (size 983795 sec)                         | |
     |                                                                    | |
     |Start (sec) [20546]: 0                                              | |
     +--------------------------------------------------------------------+ |
               +------------------------------------------------------------+

---

Next change "size":

---

 We now have your disklabel partitions for wd0 below.  This is your last   
 chance to chan+------------------------------------------------------------+
               | The current values for this partition are                  |
 Flags: (I)nsta| displayed below.                                           |
               |                                                            |
     Start (sec| Select the field you wish to change:                       |
    -----------|                                                            |
>a:        2054| a:             type : FFS                                  |
 b:       98379| b:            start : 0 sec                                |
 c:            |>c:             size : 983794 sec                           |
    -----------| d:              end : 983794 sec                           |
 e: Change inpu| e:          install : Yes                                  |
 f: Edit name o| f:            newfs : No                                   |
 g: Clone exter| g:            mount : Yes                                  |
 h: Cancel     | h:    mount options :                                      |
 x: Partition s| i:      mount point : /                                    |
               | j: Change input units (sectors/cylinders/MB/GB)            |
               | k: Restore original values                                 |
               | l: Delete partition                                        |
               | m: Cancel                                                  |
               | x: OK                                                      |
               +------------------------------------------------------------+

---

 We now have your disklabel partitions for wd0 below.  This is your last   
 chance to chan+------------------------------------------------------------+
               | The current values for this partition are                  |
 Flags: (I)nsta| displayed below.                                           |
               |                                                            |
     Start (sec| Select the field you wish to change:                       |
    -----------|                                                            |
>a:        2054| a:             type : FFS                                  |
 b:       98379| b:            start : 0 sec                                |
 c:            |>c:             size : 983794 sec                           |
    -----------| d:              end : 983794 sec                           |
 e: C+--------------------------------------------------------------------+ |
 f: E|Special values that can be entered for the size value:              | |
 g: C|    -1:   use until the end                                         | |
 h: C|   a-c:   use until the given partition                             | |
 x: P|                                                                    | |
     |Size (max 20546 sec) [20546]:                                       | |
     +--------------------------------------------------------------------+ |
               | l: Delete partition                                        |
               | m: Cancel                                                  |
               | x: OK                                                      |
               +------------------------------------------------------------+

---

sysinst shows "(max 20546 sec)" but it should be "(20546 + 983794)"
in this case.

>Fix:
Check boundaries correctly even in "moving forward" case?

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55381 CVS commit: src/usr.sbin/sysinst
Date: Tue, 29 Sep 2020 14:29:56 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Sep 29 14:29:56 UTC 2020

 Modified Files:
 	src/usr.sbin/sysinst: defs.h label.c part_edit.c

 Log Message:
 PR 55381: try to deal with moved (but not yet saved) partitions when
 calculating free space


 To generate a diff of this commit:
 cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/sysinst/defs.h
 cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/sysinst/label.c
 cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/part_edit.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Thu, 29 Dec 2022 20:46:44 +0000
State-Changed-Why:
netbsd-9 affected


State-Changed-From-To: needs-pullups->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sat, 31 Dec 2022 06:05:42 +0000
State-Changed-Why:
already handled in ticket #1113 ("PR 55381" was not detected by gnats)
 https://mail-index.netbsd.org/source-changes/2020/10/15/msg122964.html


>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-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.