[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#913431: marked as done (partman-base: Add support for kiB, MiB, ... input)



Your message dated Fri, 12 May 2023 00:38:11 +0000
with message-id <E1pxGnT-00Bn5U-2a@fasolo.debian.org>
and subject line Bug#913431: fixed in partman-base 225
has caused the Debian Bug report #913431,
regarding partman-base: Add support for kiB, MiB, ... input
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
913431: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913431
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: partman-base
Severity: wishlist
Tags: patch

  Hi,

  For a few years, Debian applied the standard that
kB, MB, ... are power-of-ten units and kiB, MiB, ...
are power-of-two units:
https://wiki.debian.org/ConsistentUnitPrefixes

  Currently, the debian-installer (more precisely
partman) only accept power-of-ten units.

  This patch add support for power-of-two units.
It does not change the output (as the patch in
#684128 was doing if I read it correctly).

  As the patch modifies only the input
(accepting some things that were refused before)
and not the output, I do not think it will break
anything. Nevertheless, it would be good if it
is applied soon enought so that testing could
occurs in good condition.

  For information, I've the habit of always
using power-of-two size for LVM lv. It means
that, for several years, I switch to the
second virtual console during my Debian
installations in order to manually invoke
"lvm lvcreate -L XXGiB -n name vg-name"
as I cannot do it with partman. It is
especially useful for the swap partition
(that I want to have the same space as
the RAM).
  I always thinked it would be fixed in
the next release, but as it is not yet
done (for several releases), I propose
this patch.

  Regards,
    Vincent


-- System Information:
Debian Release: buster/sid
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel, mipsel

Kernel: Linux 4.19.0-rc7-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From e5b23df47a4a3d771a764f6e12193cc71718c954 Mon Sep 17 00:00:00 2001
From: Vincent Danjean <Vincent.Danjean@ens-lyon.org>
Date: Sat, 10 Nov 2018 21:56:27 +0100
Subject: [PATCH] Allows one to use power-of-two units in human2longint

kiB, MiB, GiB, TiB are now allowed and computed correctly
---
 lib/base.sh | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/lib/base.sh b/lib/base.sh
index ae7a8704..0bc91695 100644
--- a/lib/base.sh
+++ b/lib/base.sh
@@ -314,7 +314,7 @@ longint2human () {
 }
 
 human2longint () {
-	local human orighuman gotb suffix int frac longint
+	local human orighuman gotb suffix int frac longint binary
 	set -- $*; human="$1$2$3$4$5" # without the spaces
 	orighuman="$human"
 	human=${human%b} #remove last b
@@ -323,6 +323,15 @@ human2longint () {
 	if [ "$human" != "$orighuman" ]; then
 		gotb=1
 	fi
+	binary=${human#${human%?}} # the last symbol of $human
+	case $binary in
+	i)
+		human=${human%$binary}
+		;;
+	*)
+		binary=''
+		;;
+	esac
 	suffix=${human#${human%?}} # the last symbol of $human
 	case $suffix in
 	k|K|m|M|g|G|t|T)
@@ -342,23 +351,35 @@ human2longint () {
 	frac="${frac#[.,]}0000" # to be sure there are at least 4 digits
 	frac=${frac%${frac#????}} # only the first 4 digits of $frac
 	longint=$(expr "$int" \* 10000 + "$frac")
-	case $suffix in
-	b|B)
-		longint=${longint%????}
+	case $binary$suffix in
+	b|B|ib|iB|i)
+		longint=${int}
 		[ "$longint" ] || longint=0
 		;;
 	k|K)
 		longint=${longint%?}
 		;;
+	ik|iK)
+		longint=$(expr "$longint" \* 1024 / 10000 )
+		;;
 	m|M)
 		longint=${longint}00
 		;;
+	im|iM)
+		longint=$(expr "$longint" \* 1048576 / 10000 )
+		;;
 	g|G)
 		longint=${longint}00000
 		;;
+	ig|iG)
+		longint=$(expr "$longint" \* 1073741824 / 10000 )
+		;;
 	t|T)
 		longint=${longint}00000000
 		;;
+	it|iT)
+		longint=$(expr "$longint" \* 1099511627776 / 10000 )
+		;;
 	*) # no suffix:
 		# bytes
 		#longint=${longint%????}
-- 
2.19.1


--- End Message ---
--- Begin Message ---
Source: partman-base
Source-Version: 225
Done: Cyril Brulebois <kibi@debian.org>

We believe that the bug you reported is fixed in the latest version of
partman-base, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 913431@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Cyril Brulebois <kibi@debian.org> (supplier of updated partman-base package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Fri, 12 May 2023 02:21:46 +0200
Source: partman-base
Architecture: source
Version: 225
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Cyril Brulebois <kibi@debian.org>
Closes: 913431
Changes:
 partman-base (225) unstable; urgency=medium
 .
   [ Vincent Danjean ]
   * Add support for input submitted using power-of-two units (kiB, MiB, …).
     Note that sizes are still output as power-of-ten units (kB, MB, …)
     (Closes: #913431).
   * Add support for bigger prefixes while doing so:
      - petabyte (PB) and pebibyte (PiB);
      - exabyte (EB) and exbibyte (EiB).
Checksums-Sha1:
 700dbb1bea9f63b2af9408b96c082b75f16f9625 1852 partman-base_225.dsc
 5424c0078a269a3b4aaeb3173e11f0effa3082c0 178784 partman-base_225.tar.xz
 12c638e6d8fd013a88787ed44ee32796add58000 7068 partman-base_225_source.buildinfo
Checksums-Sha256:
 074369a1e1f05fa804c66cf456ded0d5e4ec92788a31307938f79def7d431950 1852 partman-base_225.dsc
 a74e2ffd89354672933022a2c5b55ab5bd38b37c56f0331bc4c16c3cb6c6f470 178784 partman-base_225.tar.xz
 7f1d847cdf54882250f3fa8840f112655d80e2d1da8ce234b84ad6b2dbcb8696 7068 partman-base_225_source.buildinfo
Files:
 192d55dc24a719224f1840a117244660 1852 debian-installer standard partman-base_225.dsc
 3c332109f250f17a173d68344d39c1b6 178784 debian-installer standard partman-base_225.tar.xz
 1133990f4c1e7254c6800faac9963525 7068 debian-installer standard partman-base_225_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEEtg6/KYRFPHDXTPR4/5FK8MKzVSAFAmRdhsIQHGtpYmlAZGVi
aWFuLm9yZwAKCRD/kUrwwrNVIL9wD/9RZ8WIqT8odS10uMH+mUGPlsETuAUvW/KO
hCzT5Y194ro+mTPOVCn+1daW0lbmWC6jVay+4rEQOeNXW3wZ9RXEvEiawgD1Z6L2
P457AxVlA9GoSZT34Ficehe4O04rkQy1PVER6LMh8hmLiVvaNYPJsRXM86SU5Ghm
BCKLtl+CSz6PZNdyDhe0AFLCixQQapFlpX/wDQ6/hil/R73F/BiWMfpmtdDiXbQn
GjaCiFyViQnYb48koacqMZRczd3Rx2vGglfQP6nl8OWdHdrY+i8JUYjw3gEF41Re
dDUZe2peKob3lZw6Pq7qZE3TFSWOqUuoOx8rertbHtXSpvjD17hrhLfRGmqTEGP+
r8T7RixdtFdEKoLyNKJhHl6wW3J0ampyCvrC5pQm/n/h4hfs+JgIe2TD8FX7+Xpd
GABpUQ3GZI4rjhg5JxFKLgkyU0ptBY3Tk/Kse+lvqTKWPPBhWSHkz7ct/UqQLxep
5BkAytkHQGwuZlnlc3Eo82XccjrxR6cvugWyUwQtNi9OaSqx/voKHp2lEYVehMBR
w5Qa+Y0S5em1gZnz36xhQbFEW5UykpfZeLhatfuccmTmj+yBiC2p4ATDKrhQv1P/
Hm9h73I1Kqx3duT9M6Zih+OINYY0+lTJWAu4ABT6gfJnr00J7ScYvUDnhQkyJs43
RFAcLQOIpw==
=3RpJ
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: