diff options
author | Kr1ss | 2019-08-24 15:09:16 +0200 |
---|---|---|
committer | Kr1ss | 2019-08-24 15:30:00 +0200 |
commit | 895f7874a5ae4bfdd968599d1505ad8b7d92dc85 (patch) | |
tree | 0c45de6f16283bba91d9e69725acedc393d919c2 | |
parent | 036cb8f2003eb608deb5187ac568f01783b93ded (diff) | |
download | aur-895f7874a5ae4bfdd968599d1505ad8b7d92dc85.tar.gz |
fix floating point issue with some locales
The script assumes being run in a locale where the decimal point is `.`
causing it to fail when `printf` actually expects something else, like
a `,`.
This patch simply sets the `LC_NUMERIC` environment variable to `C` for
the affected `printf` statements.
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | PKGBUILD | 14 | ||||
-rw-r--r-- | archlinux.patch | 27 |
3 files changed, 39 insertions, 7 deletions
@@ -1,12 +1,13 @@ pkgbase = reddio-git pkgdesc = A command-line interface for Reddit written in POSIX sh pkgver = r134.66c12ce - pkgrel = 1 + pkgrel = 2 url = https://gitlab.com/aaronNG/reddio changelog = ISSUES arch = any license = custom:MIT makedepends = git + depends = dash depends = curl depends = jq optdepends = gnu-netcat: authenticate with your Reddit account credentials @@ -14,7 +15,9 @@ pkgbase = reddio-git provides = reddio conflicts = reddio source = git+https://gitlab.com/aaronNG/reddio + source = archlinux.patch sha256sums = SKIP + sha256sums = d56a36a70ea279778a60e8b827c80166189584dce54bdeeccb8f33a047419157 pkgname = reddio-git @@ -6,7 +6,7 @@ pkgver() { printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } pkgver=r134.66c12ce -pkgrel=1 +pkgrel=2 pkgdesc='A command-line interface for Reddit written in POSIX sh' arch=('any') @@ -16,19 +16,21 @@ license=('custom:MIT') provides=("${pkgname%-git}") conflicts=("${pkgname%-git}") -depends=('curl' 'jq') +depends=('dash' 'curl' 'jq') optdepends=('gnu-netcat: authenticate with your Reddit account credentials' 'openbsd-netcat: authenticate with your Reddit account credentials') makedepends=('git') changelog=ISSUES -source=("git+$url") -sha256sums=('SKIP') +source=("git+$url" 'archlinux.patch') +sha256sums=('SKIP' 'd56a36a70ea279778a60e8b827c80166189584dce54bdeeccb8f33a047419157') prepare() { cd "${pkgname%-git}" - # Arch packages are never ever installed to /usr/local/ - sed -i 's|/usr/local/|/usr/|g' "${pkgname%-git}" + # Bash's printf statement may fail when using `.` as decimal point under + # certain locales, so for the time being we set `LC_ALL` to `C`. + # Also, Arch packages are never ever installed to `/usr/local/`. + patch -Np1 <../archlinux.patch } package() { diff --git a/archlinux.patch b/archlinux.patch new file mode 100644 index 000000000000..bacb90a4ca22 --- /dev/null +++ b/archlinux.patch @@ -0,0 +1,27 @@ +diff -ur old/reddio new/reddio +--- old/reddio 2019-08-24 14:59:17.992503592 +0200 ++++ new/reddio 2019-08-24 15:00:06.863109059 +0200 +@@ -185,7 +185,7 @@ + load_config "$config_file" + + # Environment variable has precedence over config +- lib_dir=${REDDIO_LIB:-${lib_dir:-/usr/local/share/reddio}} ++ lib_dir=${REDDIO_LIB:-${lib_dir:-/usr/share/reddio}} + + # Make sure the lib directory can be found + [ -d "$lib_dir" ] \ +diff -ur old/share/reddio/pretty-time.sh new/share/reddio/pretty-time.sh +--- old/share/reddio/pretty-time.sh 2019-08-24 14:59:37.992753822 +0200 ++++ new/share/reddio/pretty-time.sh 2019-08-24 15:00:26.673348916 +0200 +@@ -41,9 +41,9 @@ + # Fractions greater than 95 will round up to a whole number + # We do not want to show the .0 + elif [ "$_frac" -gt 95 ]; then +- printf '%.0f %ss ago\n' $_int.$_frac $2 ++ LC_NUMERIC=C printf '%.0f %ss ago\n' $_int.$_frac $2 + # Everything else is shown with one decimal + else +- printf '%.1f %ss ago\n' $_int.$_frac $2 ++ LC_NUMERIC=C printf '%.1f %ss ago\n' $_int.$_frac $2 + fi + } |