diff options
author | Michał Masłowski <mtjm@mtjm.eu> | 2012-02-07 15:10:29 +0100 |
---|---|---|
committer | Michał Masłowski <mtjm@mtjm.eu> | 2012-02-07 15:10:29 +0100 |
commit | 4c4400925b792b694511bbbf2f645fb34495d5cf (patch) | |
tree | 86a3b3c62e75fdf9c536306d195bbbcbc7ac974c /testing/kmod/0008-Use-realpath-to-canonicalize-provided-paths.patch | |
parent | 08adec2ac14efea1ef452e79ff86f024b9becaf3 (diff) | |
parent | 1fa6edfba8d1e31ca1c0d59e8202cd3c62ccf393 (diff) |
Merge branch 'master' of ssh://parabolagnulinux.org:1863/home/parabola/abslibre-pre-mips64el
Conflicts:
community/bwbar/PKGBUILD
community/directfb/PKGBUILD
community/extremetuxracer/PKGBUILD
community/freedroidrpg/PKGBUILD
community/gnash/PKGBUILD
community/guake/PKGBUILD
community/pidgin-libnotify/PKGBUILD
community/png2ico/PKGBUILD
community/ruby-gtk2/PKGBUILD
community/torcs/PKGBUILD
community/virtualbox/PKGBUILD
extra/abiword/PKGBUILD
extra/alsaplayer/PKGBUILD
extra/automoc4/PKGBUILD
extra/cagibi/PKGBUILD
extra/fltk/PKGBUILD
extra/gnome-desktop2/PKGBUILD
extra/gnome-python/PKGBUILD
extra/gnome-sharp/PKGBUILD
extra/gnugo/PKGBUILD
extra/gstreamer0.10-good/PKGBUILD
extra/gtk2/PKGBUILD
extra/gtkmm/PKGBUILD
extra/imlib2/PKGBUILD
extra/koffice/PKGBUILD
extra/lcms/PKGBUILD
extra/libao/PKGBUILD
extra/libcue/PKGBUILD
extra/libdaemon/PKGBUILD
extra/libgnome-media-profiles/PKGBUILD
extra/libotf/PKGBUILD
extra/libotr/PKGBUILD
extra/libots/PKGBUILD
extra/libreoffice/PKGBUILD
extra/libtiff/PKGBUILD
extra/libwebkit/PKGBUILD
extra/libwmf/PKGBUILD
extra/libxfcegui4/PKGBUILD
extra/mjpegtools/PKGBUILD
extra/netpbm/PKGBUILD
extra/php/PKGBUILD
extra/plotutils/PKGBUILD
extra/poppler/PKGBUILD
extra/qrencode/PKGBUILD
extra/qt/PKGBUILD
extra/qtiplot/PKGBUILD
extra/rssh/PKGBUILD
extra/scim-chewing/PKGBUILD
extra/scim-m17n/PKGBUILD
extra/scim-pinyin/PKGBUILD
extra/scim-tables/PKGBUILD
extra/scim-uim/PKGBUILD
extra/tsocks/PKGBUILD
extra/vigra/PKGBUILD
extra/w3m/PKGBUILD
extra/wv/PKGBUILD
extra/xclip/PKGBUILD
extra/xfce4-datetime-plugin/PKGBUILD
extra/xfce4-notes-plugin/PKGBUILD
extra/xfce4-quicklauncher-plugin/PKGBUILD
extra/xfce4-sensors-plugin/PKGBUILD
extra/xorg-font-util/PKGBUILD
extra/xorg-setxkbmap/PKGBUILD
extra/xorg-xev/PKGBUILD
extra/xsane/PKGBUILD
extra/yakuake/PKGBUILD
extra/zvbi/PKGBUILD
multilib/lib32-cairo/PKGBUILD
multilib/lib32-gdk-pixbuf2/PKGBUILD
multilib/lib32-libcanberra/PKGBUILD
multilib/lib32-libcups/PKGBUILD
multilib/lib32-libglade/PKGBUILD
multilib/lib32-libpng/PKGBUILD
multilib/lib32-libtiff/PKGBUILD
multilib/lib32-pango/PKGBUILD
multilib/lib32-qt/PKGBUILD
multilib/lib32-sdl_image/PKGBUILD
multilib/wine/PKGBUILD
testing/vlc/PKGBUILD
testing/xulrunner/PKGBUILD
Diffstat (limited to 'testing/kmod/0008-Use-realpath-to-canonicalize-provided-paths.patch')
-rw-r--r-- | testing/kmod/0008-Use-realpath-to-canonicalize-provided-paths.patch | 163 |
1 files changed, 0 insertions, 163 deletions
diff --git a/testing/kmod/0008-Use-realpath-to-canonicalize-provided-paths.patch b/testing/kmod/0008-Use-realpath-to-canonicalize-provided-paths.patch deleted file mode 100644 index 652d2e854..000000000 --- a/testing/kmod/0008-Use-realpath-to-canonicalize-provided-paths.patch +++ /dev/null @@ -1,163 +0,0 @@ -From 4148d50c980e20a71b5e284e93863b4f36f4fbe4 Mon Sep 17 00:00:00 2001 -From: Dan McGee <dan@archlinux.org> -Date: Fri, 3 Feb 2012 15:01:34 -0600 -Subject: [PATCH 8/8] Use realpath() to canonicalize provided paths - -The existing function choked in several corner cases: -* '/tmp/../tmp' was seen as absolute, so not cleaned up. -* '/tmp/' and '/tmp' were not equal, causing depmod to act differently - when called with the -b option for the two paths. - -Don't reinvent the wheel; just use the standard library function. - -Signed-off-by: Dan McGee <dan@archlinux.org> ---- - libkmod/libkmod-module.c | 6 +++--- - libkmod/libkmod-util.c | 36 ------------------------------------ - libkmod/libkmod-util.h | 2 -- - libkmod/libkmod.c | 13 +++++++++---- - tools/kmod-depmod.c | 8 ++++++-- - 5 files changed, 18 insertions(+), 47 deletions(-) - -diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c -index 48e4aa1..48e7286 100644 ---- a/libkmod/libkmod-module.c -+++ b/libkmod/libkmod-module.c -@@ -326,10 +326,10 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx, - if (ctx == NULL || path == NULL || mod == NULL) - return -ENOENT; - -- abspath = path_make_absolute_cwd(path); -+ abspath = canonicalize_file_name(path); - if (abspath == NULL) { -- DBG(ctx, "no absolute path for %s\n", path); -- return -ENOMEM; -+ DBG(ctx, "no canonical filename returned for %s\n", path); -+ return -errno; - } - - err = stat(abspath, &st); -diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c -index 6a9f697..02b7f63 100644 ---- a/libkmod/libkmod-util.c -+++ b/libkmod/libkmod-util.c -@@ -301,42 +301,6 @@ char *strchr_replace(char *s, int c, char r) - return s; - } - --bool path_is_absolute(const char *p) --{ -- assert(p != NULL); -- -- return p[0] == '/'; --} -- --char *path_make_absolute_cwd(const char *p) --{ -- char *cwd, *r; -- size_t plen; -- size_t cwdlen; -- -- if (path_is_absolute(p)) -- return strdup(p); -- -- cwd = get_current_dir_name(); -- if (cwd == NULL) -- return NULL; -- -- plen = strlen(p); -- cwdlen = strlen(cwd); -- -- /* cwd + '/' + p + '\0' */ -- r = realloc(cwd, cwdlen + 1 + plen + 1); -- if (r == NULL) { -- free(cwd); -- return NULL; -- } -- -- r[cwdlen] = '/'; -- memcpy(&r[cwdlen + 1], p, plen + 1); -- -- return r; --} -- - #define USEC_PER_SEC 1000000ULL - #define NSEC_PER_USEC 1000ULL - unsigned long long ts_usec(const struct timespec *ts) -diff --git a/libkmod/libkmod-util.h b/libkmod/libkmod-util.h -index c9a1a21..63c348f 100644 ---- a/libkmod/libkmod-util.h -+++ b/libkmod/libkmod-util.h -@@ -19,8 +19,6 @@ ssize_t write_str_safe(int fd, const char *buf, size_t buflen) __attribute__((no - int read_str_long(int fd, long *value, int base) __must_check __attribute__((nonnull(2))); - int read_str_ulong(int fd, unsigned long *value, int base) __must_check __attribute__((nonnull(2))); - char *strchr_replace(char *s, int c, char r); --bool path_is_absolute(const char *p) __must_check __attribute__((nonnull(1))); --char *path_make_absolute_cwd(const char *p) __must_check __attribute__((nonnull(1))); - int alias_normalize(const char *alias, char buf[PATH_MAX], size_t *len) __must_check __attribute__((nonnull(1,2))); - char *modname_normalize(const char *modname, char buf[PATH_MAX], size_t *len) __attribute__((nonnull(1, 2))); - char *path_to_modname(const char *path, char buf[PATH_MAX], size_t *len) __attribute__((nonnull(2))); -diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c -index 800a178..c578afb 100644 ---- a/libkmod/libkmod.c -+++ b/libkmod/libkmod.c -@@ -160,13 +160,18 @@ static int log_priority(const char *priority) - - static const char *dirname_default_prefix = ROOTPREFIX "/lib/modules"; - --static char *get_kernel_release(const char *dirname) -+static char *get_kernel_release(struct kmod_ctx *ctx, const char *dirname) - { - struct utsname u; - char *p; - -- if (dirname != NULL) -- return path_make_absolute_cwd(dirname); -+ if (dirname != NULL) { -+ p = canonicalize_file_name(dirname); -+ if (p) -+ return p; -+ INFO(ctx, "could not canonicalize directory %s: %m\n", dirname); -+ return strdup(dirname); -+ } - - if (uname(&u) < 0) - return NULL; -@@ -215,7 +220,7 @@ KMOD_EXPORT struct kmod_ctx *kmod_new(const char *dirname, - ctx->log_data = stderr; - ctx->log_priority = LOG_ERR; - -- ctx->dirname = get_kernel_release(dirname); -+ ctx->dirname = get_kernel_release(ctx, dirname); - - /* environment overwrites config */ - env = getenv("KMOD_LOG"); -diff --git a/tools/kmod-depmod.c b/tools/kmod-depmod.c -index 0cf28f6..72180ef 100644 ---- a/tools/kmod-depmod.c -+++ b/tools/kmod-depmod.c -@@ -1160,7 +1160,7 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod) - } - } - -- DBG("add %p kmod=%p, path=%s\n", mod, kmod, mod->path); -+ DBG("add %p kmod=%p, path=%s, relpath=%s\n", mod, kmod, mod->path, mod->relpath); - - return 0; - } -@@ -2547,7 +2547,11 @@ static int do_depmod(int argc, char *argv[]) - maybe_all = 1; - break; - case 'b': -- root = path_make_absolute_cwd(optarg); -+ root = canonicalize_file_name(optarg); -+ if (!root) { -+ CRIT("could not resolve path %s\n", optarg); -+ goto cmdline_failed; -+ } - break; - case 'C': { - size_t bytes = sizeof(char *) * (n_config_paths + 2); --- -1.7.9 - |