summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKr1ss2019-08-24 15:09:16 +0200
committerKr1ss2019-08-24 15:37:45 +0200
commitd2d4eff46fa7c807eca3d0bdd3715c9411db1733 (patch)
tree9181d199758e125a8554da408fe6fed80ace93e4
parent036cb8f2003eb608deb5187ac568f01783b93ded (diff)
downloadaur-d2d4eff46fa7c807eca3d0bdd3715c9411db1733.tar.gz
fix floating point issue with some locales
The script assumes being run in a locale where the decimal point is `.` update: reddio-git r134.66c12ce-2 a `,`. This patch simply sets the `LC_NUMERIC` environment variable to `C` for the affected `printf` statements.
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD12
-rw-r--r--archlinux.patch27
3 files changed, 37 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 797f8f933b9d..80f4a14f9bd6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
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
@@ -14,7 +14,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
diff --git a/PKGBUILD b/PKGBUILD
index 217e1dd34c50..db8b8f74e55c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -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')
@@ -22,13 +22,15 @@ optdepends=('gnu-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
+ }