Begin forwarded message:
Date: Sun, 31 Jan 2016 08:38:08 -0500 From: Adrian Mariano <[email protected]> To: Stephen Kitt <[email protected]> Subject: Re: Fw: Bug#813104: units: µs and µsecond handled inconsistently That's definitely a bug. The plural handling for these edge cases is hard to figure out. The way it's written is that prefixes longer than one character are allowed to take plurals, which hides the second when it's written as "s". This means that "micros" parses as the plural of micro, which seems more reasonable than parsing as micro-s. It also means that "has" interprets as the plural of "ha" rather than the hecto second. Not sure what's reasonable in that case. Anyway, the example you found fails because the string length of the "micron" symbol is larger than 1 in its UTF-8 representation. The simplest fix to this problem is this: --- units.c.orig 2016-01-31 08:28:06.000000000 -0500 +++ units.c 2016-01-31 08:30:08.000000000 -0500 @@ -1984,7 +1984,7 @@ if ((uptr = ulookup(unit))) return uptr->value; - if (strlen(unit)>2 && unit[strlen(unit) - 1] == 's') { + if (strwidth(unit)>2 && unit[strlen(unit) - 1] == 's') { copy = dupstr(unit); copy[strlen(copy) - 1] = 0; if (lookupunit(copy,prefixok)){ On Sun, Jan 31, 2016 at 11:35:02AM +0100, Stephen Kitt wrote: > Hi Adrian, > > What do you think of this? > > Regards, > > Stephen > > > Begin forwarded message: > > Date: Fri, 29 Jan 2016 12:01:17 +0100 > From: Lionel Elie Mamane <[email protected]> > To: Debian Bug Tracking System <[email protected]> > Subject: Bug#813104: units: µs and µsecond handled inconsistently > > > Package: units > Version: 2.11-1 > Severity: normal > > units handles "s" for second, "µ" for "micro" as is SI standard. But the > combination of the two is not handled correctly. > > For example: > > $ units µg > Definition: micro g = 1e-09 kg > $ units µg ng > * 1000 > / 0.001 > > And: > > $ units ms ns > * 1000000 > / 1e-06 > > But: > > $ units µs ns > conformability error > 1e-06 > 1e-09 s > > By contrast: > $ units µsecond ns > * 1000 > / 0.001 > > > > -- System Information: > Debian Release: 8.3 > APT prefers testing-updates > APT policy: (500, 'testing-updates'), (500, 'stable-updates'), (500, > 'stable'), (400, 'testing'), (300, 'unstable'), (1, 'experimental') > Architecture: amd64 (x86_64) Foreign Architectures: i386 > > Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores) > Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8) > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) > > Versions of packages units depends on: > ii libc6 2.19-18+deb8u2 > ii libreadline6 6.3-8+b3 > > Versions of packages units recommends: > pn python:any <none> > > units suggests no packages. > > -- no debconf information
pgpjYZNd_Fbl4.pgp
Description: OpenPGP digital signature

