diff options
author | 2009-12-23 15:12:36 +0000 | |
---|---|---|
committer | 2009-12-23 15:12:36 +0000 | |
commit | 7d7650aee9b0bd119f3a8ce0dd9c8b1d7f5fb2cb (patch) | |
tree | 6237455bd0cf612a76a0e9094e40d5246538f112 /sys-process | |
parent | Version bump (diff) | |
download | historical-7d7650aee9b0bd119f3a8ce0dd9c8b1d7f5fb2cb.tar.gz historical-7d7650aee9b0bd119f3a8ce0dd9c8b1d7f5fb2cb.tar.bz2 historical-7d7650aee9b0bd119f3a8ce0dd9c8b1d7f5fb2cb.zip |
Fix segmentation fault with false options e.g. "fuser --help" wrt #297423 and everything up to fuser.c Rev. 1.59, fuser.h Rev. 1.7.
Package-Manager: portage-2.2_rc60/cvs/Linux x86_64
Diffstat (limited to 'sys-process')
-rw-r--r-- | sys-process/psmisc/ChangeLog | 9 | ||||
-rw-r--r-- | sys-process/psmisc/Manifest | 4 | ||||
-rw-r--r-- | sys-process/psmisc/files/psmisc-22.8-fuser-r159.patch | 249 | ||||
-rw-r--r-- | sys-process/psmisc/psmisc-22.8-r1.ebuild | 52 |
4 files changed, 312 insertions, 2 deletions
diff --git a/sys-process/psmisc/ChangeLog b/sys-process/psmisc/ChangeLog index 720a8cc43988..21462bcce68e 100644 --- a/sys-process/psmisc/ChangeLog +++ b/sys-process/psmisc/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-process/psmisc # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-process/psmisc/ChangeLog,v 1.91 2009/12/11 11:45:40 ssuominen Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-process/psmisc/ChangeLog,v 1.92 2009/12/23 15:12:36 ssuominen Exp $ + +*psmisc-22.8-r1 (23 Dec 2009) + + 23 Dec 2009; Samuli Suominen <ssuominen@gentoo.org> + +psmisc-22.8-r1.ebuild, +files/psmisc-22.8-fuser-r159.patch: + Fix segmentation fault with false options e.g. "fuser --help" wrt #297423 + and everything up to fuser.c Rev. 1.59, fuser.h Rev. 1.7. *psmisc-22.8 (11 Dec 2009) diff --git a/sys-process/psmisc/Manifest b/sys-process/psmisc/Manifest index eb4de45c4d03..8ba865e74fb9 100644 --- a/sys-process/psmisc/Manifest +++ b/sys-process/psmisc/Manifest @@ -1,7 +1,9 @@ AUX psmisc-22.5-no-nls.patch 736 RMD160 ac2c51cccc6c95f0aa47efe1ecaeb0d5eaefbce9 SHA1 0227573aa987bfb78ecef891673dc2792c98aba5 SHA256 b2137d22d62276cbd4a1b154c119df025d864054063302a91b5a1610f6c7102c +AUX psmisc-22.8-fuser-r159.patch 6741 RMD160 8d8bf65eac6d317693cd931ace6af3202927b715 SHA1 3f30927e689944ed1911a48df436222e333fcf83 SHA256 164bb4b01c6eb68f9f2042475a964eec5170ff92fed8e8c89584d0f0f1dd07a4 DIST psmisc-22.7.tar.gz 309178 RMD160 97341ce1953d2c226f01d92e952e7a001456be15 SHA1 8226ecc284c8cd1e151523df56a1ba9f9c0fa3f5 SHA256 049c874c3353798afe9223dde8450376bd8a5cc336f863fb9294238735d11dad DIST psmisc-22.8.tar.gz 310358 RMD160 1e7fd6167de21d8fc5e81af00aa97b9cc9b07d80 SHA1 bce327dc1dad257a67c2fbe9ca7bf227d6d52a51 SHA256 db304ec5349564acc484d84df283466c37ff6938c420d928db1d199121097e8c EBUILD psmisc-22.7.ebuild 1567 RMD160 8fd6f390835d2ad65154e3ca633ebe1fd0a714af SHA1 16495bfb83c788327f5239b2249df11a77ad0cf9 SHA256 d160ee5e7c15658b1a476c2cdb75216ef6c05288e46071d9a5e74cee0cc1b9d3 +EBUILD psmisc-22.8-r1.ebuild 1567 RMD160 d02356b3db1cfd61ca74debb0e0d77e14dad5d80 SHA1 15de123242905a62dbeb3bb3d328876c52d1c6f3 SHA256 c008bbf1e2cafacfd11bc8ca8c0cf443fe13026d1f0d9f5163ef84ae0a9c1229 EBUILD psmisc-22.8.ebuild 1520 RMD160 8d5c137f839894e794acfb60a34cebecdaf1b84c SHA1 f1c0befa2826344606b43ebdb757dda4693d40da SHA256 d9d4aec2f7d55684106c654e757dff820ec34af53ed2749d3fb622e60fde3183 -MISC ChangeLog 16464 RMD160 587da933396ab399078301254da5ab45def57fcf SHA1 839436423c51b62168d6b26b86a150a55872d277 SHA256 b4823739ce5046fb3002be2c7d295f8b429d3e35d27ebc75e78a722a30b4e63f +MISC ChangeLog 16749 RMD160 6a69affde10c3f4afd30eedc249f268507524595 SHA1 b99f1ba34a71e5815c6a09e0b59e9a84ceb2c333 SHA256 60009e8dc0484c05809698c57e576c23663259a44193fce015f536fb1ddf70a6 MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92 diff --git a/sys-process/psmisc/files/psmisc-22.8-fuser-r159.patch b/sys-process/psmisc/files/psmisc-22.8-fuser-r159.patch new file mode 100644 index 000000000000..95edee7709fb --- /dev/null +++ b/sys-process/psmisc/files/psmisc-22.8-fuser-r159.patch @@ -0,0 +1,249 @@ +http://bugs.gentoo.org/show_bug.cgi?id=297423 + +Fix segmentation fault with false options e.g. "fuser --help" + +src/fuser.c Rev. 1.59 +src/fuser.h Rev 1.7 + +--- src/fuser.c 2009-07-14 02:23:38.000000000 +0300 ++++ src/fuser.c 2009-12-23 17:04:26.000000000 +0200 +@@ -102,7 +102,7 @@ + + fprintf(stderr, + _ +- ("Usage: fuser [ -fuv ] [ -a | -s ] [ -4 | -6 ] [ -c | -m | -n SPACE ] [ -k [ -i ] [ -SIGNAL ]] NAME...\n" ++ ("Usage: fuser [-fMuv] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME...\n" + " fuser -l\n" " fuser -V\n" + "Show which processes use the named files, sockets, or filesystems.\n\n" + " -a display unused files too\n" +@@ -112,6 +112,7 @@ + " -k kill processes accessing the named file\n" + " -l list available signal names\n" + " -m show all processes using the named filesystems or block device\n" ++ " -M fulfill request only if NAME is a mount point\n" + " -n SPACE search in this name space (file, udp, or tcp)\n" + " -s silent operation\n" + " -SIGNAL send this signal instead of SIGKILL\n" +@@ -767,6 +768,56 @@ + } + #endif + ++static void ++read_proc_mounts(struct mount_list **mnt_list) ++{ ++ FILE *fp; ++ char line[BUFSIZ]; ++ char *find_mountp; ++ char *find_space; ++ struct mount_list *mnt_tmp; ++ ++ if ((fp = fopen(PROC_MOUNTS, "r")) == NULL) { ++ fprintf(stderr, "Cannot open %s\n", PROC_MOUNTS); ++ return; ++ } ++ while (fgets(line, BUFSIZ, fp) != NULL) { ++ if ((find_mountp = strchr(line, ' ')) == NULL) ++ continue; ++ find_mountp++; ++ if ((find_space = strchr(find_mountp, ' ')) == NULL) ++ continue; ++ *find_space = '\0'; ++ if ((mnt_tmp = malloc(sizeof(struct mount_list))) == NULL) ++ continue; ++ if ((mnt_tmp->mountpoint = strdup(find_mountp)) == NULL) ++ continue; ++ mnt_tmp->next = *mnt_list; ++ *mnt_list = mnt_tmp; ++ } ++ fclose(fp); ++} ++ ++static int ++is_mountpoint(struct mount_list **mnt_list, char *arg) ++{ ++ char *p; ++ struct mount_list *mnt_tmp; ++ ++ if (*arg == '\0') ++ return 0; ++ /* Remove trailing slashes. */ ++ for (p = arg; *p != '\0'; p++) ++ ; ++ while (*(--p) == '/' && p > arg) ++ *p = '\0'; ++ ++ for (mnt_tmp = *mnt_list; mnt_tmp != NULL; mnt_tmp = mnt_tmp->next) ++ if (!strcmp(mnt_tmp->mountpoint, arg)) ++ return 1; ++ return 0; ++} ++ + int main(int argc, char *argv[]) + { + opt_type opts; +@@ -777,6 +828,7 @@ + unsigned char default_namespace = NAMESPACE_FILE; + struct device_list *match_devices = NULL; + struct unixsocket_list *unixsockets = NULL; ++ struct mount_list *mounts = NULL; + + dev_t netdev; + struct ip_connections *tcp_connection_list = NULL; +@@ -798,6 +850,7 @@ + {"interactive", 0, NULL, 'i'}, + {"list-signals", 0, NULL, 'l'}, + {"mount", 0, NULL, 'm'}, ++ {"ismountpoint", 0, NULL, 'M'}, + {"namespace", 1, NULL, 'n'}, + {"silent", 0, NULL, 's'}, + {"user", 0, NULL, 'u'}, +@@ -808,8 +861,7 @@ + {"ipv6", 0, NULL, '6'}, + #endif + {"SIG", 1, NULL, 'S'}, +- +- ++ { 0, 0, 0, 0 } + }; + + #ifdef WITH_IPV6 +@@ -833,9 +885,9 @@ + ignore_options=0; + while ((optc = + #ifdef WITH_IPV6 +- getopt_long(argc, argv, "46acfhikmn:sS:uvV", options,NULL) ++ getopt_long(argc, argv, "46acfhiklmMn:sS:uvV", options,NULL) + #else +- getopt_long(argc, argv, "acfhikmn:sS:uvV", options,NULL) ++ getopt_long(argc, argv, "acfhikilmMn:sS:uvV", options,NULL) + #endif + ) != -1) { + if (ignore_options > 0) { +@@ -855,7 +907,7 @@ + opts |= OPT_ALLFILES; + break; + case 'c': +- opts |= OPT_MOUNTPOINT; ++ opts |= OPT_MOUNTS; + break; + case 'f': + /* ignored */ +@@ -875,6 +927,9 @@ + case 'm': + opts |= OPT_MOUNTS; + break; ++ case 'M': ++ opts |= OPT_ISMOUNTPOINT; ++ break; + case 'n': + if (strcmp(optarg, "tcp") == 0) + default_namespace = NAMESPACE_TCP; +@@ -934,16 +989,15 @@ + + } /* switch */ + } /* while optc */ ++ if (optc == argc) ++ usage(_("No process specification given")); ++ if (opts & OPT_ISMOUNTPOINT) ++ read_proc_mounts(&mounts); + for (optc = optind; optc < argc; optc++) { + /* File specifications */ + if ((this_name = malloc(sizeof(struct names))) == NULL) + continue; + this_name->next = NULL; +- if (names_head == NULL) +- names_head = this_name; +- if (names_tail != NULL) +- names_tail->next = this_name; +- names_tail = this_name; + /* try to find namespace spec */ + this_name->name_space = default_namespace; + if (((nsptr = strchr(argv[optc], '/')) != NULL) +@@ -960,10 +1014,15 @@ + } + } + this_name->matched_procs = NULL; +- if ((opts & OPT_MOUNTS || opts & OPT_MOUNTPOINT) ++ if (opts & (OPT_MOUNTS|OPT_ISMOUNTPOINT) + && this_name->name_space != NAMESPACE_FILE) + usage(_ +- ("You can only use files with mountpoint option")); ++ ("You can only use files with mountpoint options")); ++ if (opts & OPT_ISMOUNTPOINT && ++ !is_mountpoint(&mounts, argv[optc])) { ++ free(this_name); ++ continue; ++ } + switch (this_name->name_space) { + case NAMESPACE_TCP: + if (asprintf(&(this_name->filename), "%s/tcp", argv[optc]) > 0) { +@@ -990,22 +1049,18 @@ + parse_file(this_name, &match_inodes); + parse_unixsockets(this_name, &match_inodes, + unixsockets); +- if (opts & OPT_MOUNTPOINT || opts & OPT_MOUNTS) ++ if (opts & OPT_MOUNTS) + parse_mounts(this_name, &match_devices, opts); + break; + } + ++ if (names_head == NULL) ++ names_head = this_name; ++ if (names_tail != NULL) ++ names_tail->next = this_name; ++ names_tail = this_name; + } /* for optc */ + +- if (names_head == NULL) { +- usage(_("No process specification given")); +- } +- /* Check conflicting operations */ +- if (opts & OPT_MOUNTPOINT) { +- if (opts & OPT_MOUNTS) +- usage(_ +- ("You cannot use the mounted and mountpoint flags together")); +- } + if (opts & OPT_SILENT) { + opts &= ~OPT_VERBOSE; + opts &= ~OPT_USER; +@@ -1452,13 +1507,14 @@ + struct procs *pptr; + + for (pptr = proc_head; pptr != NULL; pptr = pptr->next) { ++ if ( pptr->proc_type == PTYPE_NORMAL ) ++ continue; + if ((opts & OPT_INTERACTIVE) && (ask(pptr->pid) == 0)) + continue; +- if (kill(pptr->pid, sig_number) < 0) { ++ if ( kill(pptr->pid, sig_number) < 0) { + fprintf(stderr, _("Could not kill process %d: %s\n"), +- pptr->pid, strerror(errno)); ++ pptr->pid, strerror(errno)); + } +- + } + } + +--- src/fuser.h 2009-07-10 05:48:33.000000000 +0300 ++++ src/fuser.h 2009-12-23 17:04:26.000000000 +0200 +@@ -9,7 +9,7 @@ + #define OPT_INTERACTIVE 16 + #define OPT_SILENT 32 + #define OPT_USER 64 +-#define OPT_MOUNTPOINT 128 ++#define OPT_ISMOUNTPOINT 128 + + struct procs { + pid_t pid; +@@ -79,6 +79,11 @@ + struct unixsocket_list *next; + }; + ++struct mount_list { ++ char *mountpoint; ++ struct mount_list *next; ++}; ++ + #define NAMESPACE_FILE 0 + #define NAMESPACE_TCP 1 + #define NAMESPACE_UDP 2 diff --git a/sys-process/psmisc/psmisc-22.8-r1.ebuild b/sys-process/psmisc/psmisc-22.8-r1.ebuild new file mode 100644 index 000000000000..9143b52b8aaa --- /dev/null +++ b/sys-process/psmisc/psmisc-22.8-r1.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-process/psmisc/psmisc-22.8-r1.ebuild,v 1.1 2009/12/23 15:12:36 ssuominen Exp $ + +inherit eutils autotools + +DESCRIPTION="A set of tools that use the proc filesystem" +HOMEPAGE="http://psmisc.sourceforge.net/" +SRC_URI="mirror://sourceforge/psmisc/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="ipv6 nls selinux X" + +RDEPEND=">=sys-libs/ncurses-5.2-r2 + selinux? ( sys-libs/libselinux )" +DEPEND="${RDEPEND} + sys-devel/libtool + nls? ( sys-devel/gettext )" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-fuser-r159.patch + use nls || epatch "${FILESDIR}"/${PN}-22.5-no-nls.patch #193920 + eautoreconf +} + +src_compile() { + # the nls looks weird, but it's because we actually delete the nls stuff + # above when USE=-nls. this should get cleaned up so we dont have to patch + # it out, but until then, let's not confuse users ... #220787 + econf \ + --disable-dependency-tracking \ + $(use_enable selinux) \ + $(use_enable ipv6) \ + $(use nls && use_enable nls) + + emake || die +} + +src_install() { + emake DESTDIR="${D}" install || die + dodoc AUTHORS ChangeLog NEWS README + use X || rm "${D}"/usr/bin/pstree.x11 + # fuser is needed by init.d scripts + dodir /bin + mv "${D}"/usr/bin/fuser "${D}"/bin/ || die + # easier to do this than forcing regen of autotools + [[ -e ${D}/usr/bin/peekfd ]] || rm -f "${D}"/usr/share/man/man1/peekfd.1 +} |