Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 485182 - sys-devel/patch-2.7.1-r2 - SIGSEGV on nonexisting dir
Summary: sys-devel/patch-2.7.1-r2 - SIGSEGV on nonexisting dir
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://savannah.gnu.org/bugs/index.p...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-17 09:59 UTC by Martin von Gagern
Modified: 2013-10-15 08:33 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2013-09-17 09:59:33 UTC
$ patch -d no-such-dir
patch: **** Can't change to directory no-such-dir : No such file or directory
Segmentation fault

With gdb, the backtrace looks like this:

Program received signal SIGSEGV, Segmentation fault.
gl_list_iterator_inline (list=0x0) at ../lib/gl_list.h:762
762              ->iterator (list);
(gdb) bt
#0  gl_list_iterator_inline (list=0x0) at ../lib/gl_list.h:762
#1  forget_output_files () at patch.c:1935
#2  cleanup () at patch.c:1978
#3  0x0000000000407128 in fatal_exit (sig=sig@entry=0) at patch.c:1953
#4  0x000000000040d358 in pfatal (
    format=format@entry=0x419319 "Can't change to directory %s") at util.c:952
#5  0x0000000000403016 in get_some_switches () at patch.c:875
#6  main (argc=<optimized out>, argv=<optimized out>) at patch.c:156

Seems like forget_output_files should check whether or not files_to_output has been initialized. Not sure whether comparing it to NULL is appropriate or not.

Also reported this upstream: https://savannah.gnu.org/bugs/index.php?40049
Not sure whether you want to introduce a patch or wait for upstream.
Comment 1 Paul Bredbury 2013-09-17 13:04:51 UTC
Arch has a patch for that, used since Dec-2012:

https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/patch
Comment 2 Martin von Gagern 2013-09-24 22:18:09 UTC
Upstream indicates that this is already fixed in git. The relevant commit is http://git.savannah.gnu.org/cgit/patch.git/commit/?id=291ec175812b7ba291d124e4

(In reply to Paul Bredbury from comment #1)
> Arch has a patch for that, used since Dec-2012:

The above is identical to that one: they got it from the same git repository. I should have considered that possibility, and checked the official repo. In any case, this makes the patch you provided pretty official.
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-10-15 08:33:21 UTC
+*patch-2.7.1-r3 (15 Oct 2013)
+
+  15 Oct 2013; Lars Wendler <polynomial-c@gentoo.org> -patch-2.7.1.ebuild,
+  -patch-2.7.1-r1.ebuild, patch-2.7.1-r2.ebuild, +patch-2.7.1-r3.ebuild,
+  +files/patch-2.7.1-initialize_data_structures_early_enough.patch,
+  +files/patch-2.7.1-prevent_depend_on_autotools.patch:
+  Revbump to fix segfault on nonexisting dir. Thanks to Martin von Gagern for
+  reporting this in bug #485182. Removed old versions.
+