diff options
author | Mark White <mark@celos.net> | 2016-02-09 09:36:28 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-02-15 10:42:08 +0000 |
commit | 5d7a4ebb42c965c69c944e69b1a0a3a56eb5ed53 (patch) | |
tree | 17a83723468de9e7c97c046c63710ddc1b911279 | |
parent | 7f00c15878265d146be084435d3509c2cf44ebfe (diff) | |
download | aports-5d7a4ebb42c965c69c944e69b1a0a3a56eb5ed53.tar.bz2 aports-5d7a4ebb42c965c69c944e69b1a0a3a56eb5ed53.tar.xz |
testing/i3wm: expand tilde in config path
Expand ~ to $HOME if path begins with "~/". Not a complete GLOB_TILDE,
but fixes current default use of literal "$HOME/~/.config/i3".
fixes #5078
-rw-r--r-- | testing/i3wm/APKBUILD | 8 | ||||
-rw-r--r-- | testing/i3wm/musl.patch | 46 |
2 files changed, 38 insertions, 16 deletions
diff --git a/testing/i3wm/APKBUILD b/testing/i3wm/APKBUILD index 57597b6429..03a4368ed8 100644 --- a/testing/i3wm/APKBUILD +++ b/testing/i3wm/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=i3wm pkgver=4.11 -pkgrel=0 +pkgrel=1 pkgdesc="A tiling window manager" url="http://i3wm.org" arch="all" @@ -42,8 +42,8 @@ package() { } md5sums="6b003955333a90cb831516f8dbf6e57d i3-4.11.tar.bz2 -c111abf5d38d2ad356923047a47f6a65 musl.patch" +aa998beb0b9a83d2910508768ac7faae musl.patch" sha256sums="78ce1e06fbd92fd63765bbe23faa7b8f929c17f99ed623f7abf2e568169d982f i3-4.11.tar.bz2 -626886ec7edfa768b4ab8cb9eaef4b3944e0a7cac2bb6748b7ce2622c409d08a musl.patch" +b7d084c53addc71fda13ccb8b3dcca2a32d9ca1590a28bf3be1a0c61870d3817 musl.patch" sha512sums="76d45be9006973dd4093fd21ea1c83742b7977c7698e133ce8f9e7826d97d1631fbe6c3ea4a7eb3d989027f98e12738158e72ec450b0df3dddd28f912ff49a4f i3-4.11.tar.bz2 -b3d2947f95b83f4421b54899d6411d93124828fcb06d6777330db523b8a101ab425bc3201c1aaed00206b468320c85617a6e0657427a7a1aec4d671082aa6494 musl.patch" +8ce7d00371c43b93dabbe0dadf9caf7c58a68f4a0079f5a9b9552c15c55bfa0df16d7e87a281595af2ac5254632ba28ccf82a467cea16159b41490f6f2910299 musl.patch" diff --git a/testing/i3wm/musl.patch b/testing/i3wm/musl.patch index 56feaa9814..82ad6195b8 100644 --- a/testing/i3wm/musl.patch +++ b/testing/i3wm/musl.patch @@ -1,7 +1,7 @@ -diff -upr i3-4.11.orig/i3bar/src/main.c i3-4.11/i3bar/src/main.c ---- i3-4.11.orig/i3bar/src/main.c 2015-10-06 22:45:01.791199587 +0200 -+++ i3-4.11/i3bar/src/main.c 2015-10-06 22:45:52.921029327 +0200 -@@ -45,14 +45,7 @@ void debuglog(char *fmt, ...) { +diff -urp i3-4.11/i3bar/src/main.c i3-4.11.new/i3bar/src/main.c +--- i3-4.11/i3bar/src/main.c 2015-09-30 07:55:10.000000000 +0100 ++++ i3-4.11.new/i3bar/src/main.c 2016-02-08 20:03:41.777392482 +0000 +@@ -45,14 +45,20 @@ void debuglog(char *fmt, ...) { * */ char *expand_path(char *path) { @@ -9,24 +9,37 @@ diff -upr i3-4.11.orig/i3bar/src/main.c i3-4.11/i3bar/src/main.c - if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) { - ELOG("glob() failed\n"); - exit(EXIT_FAILURE); -- } ++ char *home, *expanded; ++ ++ if (strncmp(path, "~/", 2) == 0) { ++ home = getenv("HOME"); ++ if (home != NULL) { ++ /* new length: sum - 1 (omit '~') + 1 (for '\0') */ ++ expanded = scalloc(strlen(home)+strlen(path), 1); ++ strcpy(expanded, home); ++ strcat(expanded, path+1); ++ return expanded; ++ } + } - char *result = sstrdup(globbuf.gl_pathc > 0 ? globbuf.gl_pathv[0] : path); - globfree(&globbuf); - return result; ++ + return sstrdup(path); } void print_usage(char *elf_name) { -diff -upr i3-4.11.orig/libi3/resolve_tilde.c i3-4.11/libi3/resolve_tilde.c ---- i3-4.11.orig/libi3/resolve_tilde.c 2015-10-06 22:45:01.801199553 +0200 -+++ i3-4.11/libi3/resolve_tilde.c 2015-10-06 22:46:32.874229612 +0200 -@@ -19,27 +19,5 @@ +diff -urp i3-4.11/libi3/resolve_tilde.c i3-4.11.new/libi3/resolve_tilde.c +--- i3-4.11/libi3/resolve_tilde.c 2015-09-30 07:55:10.000000000 +0100 ++++ i3-4.11.new/libi3/resolve_tilde.c 2016-02-08 20:03:47.849230953 +0000 +@@ -19,27 +19,18 @@ * */ char *resolve_tilde(const char *path) { - static glob_t globbuf; - char *head, *tail, *result; -- ++ char *home, *expanded; + - tail = strchr(path, '/'); - head = sstrndup(path, tail ? (size_t)(tail - path) : strlen(path)); - @@ -43,9 +56,18 @@ diff -upr i3-4.11.orig/libi3/resolve_tilde.c i3-4.11/libi3/resolve_tilde.c - strncpy(result, head, strlen(head)); - if (tail) - strncat(result, tail, strlen(tail)); -- } ++ if (strncmp(path, "~/", 2) == 0) { ++ home = getenv("HOME"); ++ if (home != NULL) { ++ /* new length: sum - 1 (omit '~') + 1 (for '\0') */ ++ expanded = scalloc(strlen(home)+strlen(path), 1); ++ strcpy(expanded, home); ++ strcat(expanded, path+1); ++ return expanded; ++ } + } - globfree(&globbuf); -- + - return result; + return sstrdup(path); } |