added tempfile patch. Fixes #71595
authorRyan Phillips <rphillips@gentoo.org>
Sat, 11 Dec 2004 00:54:46 +0000 (00:54 +0000)
committerRyan Phillips <rphillips@gentoo.org>
Sat, 11 Dec 2004 00:54:46 +0000 (00:54 +0000)
dev-util/cscope/Manifest
dev-util/cscope/cscope-15.5-r3.ebuild [new file with mode: 0644]
dev-util/cscope/files/cscope-15.5-tempfile.patch [new file with mode: 0644]
dev-util/cscope/files/digest-cscope-15.5-r3 [new file with mode: 0644]

index 6ed4510100f34cfb417be612b2d7d0eb2cd756ac..48bd2f021e941eefa26b66b00fe718a0d5af6c95 100644 (file)
@@ -1,11 +1,14 @@
-MD5 973f4184ecd2105e78d3424c15e1a86c ChangeLog 5118
 MD5 336bda89fb52186ad57731559ccbd939 cscope-15.5-r1.ebuild 1604
-MD5 88e0149db74702ab5ae0ac80226f8333 cscope-15.5-r2.ebuild 1650
+MD5 d686f182142050b031084abce1f61e75 cscope-15.5-r3.ebuild 1656
 MD5 3c56dcf0da026c9a6ef0e7c204419785 cscope-15.5.ebuild 1417
+MD5 88e0149db74702ab5ae0ac80226f8333 cscope-15.5-r2.ebuild 1650
+MD5 973f4184ecd2105e78d3424c15e1a86c ChangeLog 5118
 MD5 79094d1585cb050b3855fbfe440f22b9 metadata.xml 790
+MD5 c8aeadd309e54712241dec1b77072cbb files/cscope-15.5-can-2004-0996.patch 1125
 MD5 28ddc553966bf7045758be324600f5c8 files/50xcscope-gentoo.el 95
-MD5 22e8d669b78f301c45e9075e2793dfd3 files/15.5-noclobber-tempfile-rexotec.patch 1055
-MD5 25ad9fe446a7cabf4c482bbe150c7eaa files/digest-cscope-15.5-r1 63
 MD5 25ad9fe446a7cabf4c482bbe150c7eaa files/digest-cscope-15.5 63
-MD5 c8aeadd309e54712241dec1b77072cbb files/cscope-15.5-can-2004-0996.patch 1125
+MD5 6b8c74fb664bfaada3d95003f6c1134a files/cscope-15.5-tempfile.patch 2817
+MD5 25ad9fe446a7cabf4c482bbe150c7eaa files/digest-cscope-15.5-r1 63
 MD5 25ad9fe446a7cabf4c482bbe150c7eaa files/digest-cscope-15.5-r2 63
+MD5 25ad9fe446a7cabf4c482bbe150c7eaa files/digest-cscope-15.5-r3 63
+MD5 22e8d669b78f301c45e9075e2793dfd3 files/15.5-noclobber-tempfile-rexotec.patch 1055
diff --git a/dev-util/cscope/cscope-15.5-r3.ebuild b/dev-util/cscope/cscope-15.5-r3.ebuild
new file mode 100644 (file)
index 0000000..6a71617
--- /dev/null
@@ -0,0 +1,68 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-util/cscope/cscope-15.5-r3.ebuild,v 1.1 2004/12/11 00:54:46 rphillips Exp $
+
+inherit gnuconfig elisp-common eutils
+
+DESCRIPTION="Interactively examine a C program"
+HOMEPAGE="http://cscope.sourceforge.net/"
+SRC_URI="mirror://sourceforge/cscope/${P}.tar.gz"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~x86 ~ppc ~sparc ~mips ~alpha ~arm ~hppa ~amd64 ~ia64 ~s390 ~ppc64"
+IUSE="emacs"
+
+RDEPEND=">=sys-libs/ncurses-5.2"
+DEPEND="${RDEPEND}
+       sys-devel/flex
+       sys-devel/bison
+       emacs? ( virtual/emacs )"
+
+SITEFILE=50xcscope-gentoo.el
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+       # Gentoo Bug #71595, http://www.rexotec.com/advisory/RX171104.html
+       epatch ${FILESDIR}/${PV}-noclobber-tempfile-rexotec.patch
+       epatch ${FILESDIR}/${PN}-${PV}-tempfile.patch
+}
+
+src_compile() {
+       gnuconfig_update
+
+       # This fix is no longer needed as of cscope-15.5 which now should
+       # work with bison directly.      (04 Feb 2004 agriffis)
+       #sed -i -e "s:={:{:" src/egrep.y
+
+       econf || die
+       make clean || die
+       emake || die
+
+       if use emacs ; then
+               cd ${S}/contrib/xcscope || die
+               elisp-compile *.el || die
+       fi
+}
+
+src_install() {
+       einstall || die
+       dodoc NEWS AUTHORS TODO ChangeLog INSTALL README* || die
+
+       if use emacs ; then
+               cd ${S}/contrib/xcscope || die
+               elisp-install xcscope *.el *.elc || die
+               elisp-site-file-install ${FILESDIR}/${SITEFILE} xcscope || die
+               dobin cscope-indexer || die
+       fi
+       cp -r ${S}/contrib/webcscope ${D}/usr/share/doc/${PF}/ || die
+}
+
+pkg_postinst() {
+       use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+       use emacs && elisp-site-regen
+}
diff --git a/dev-util/cscope/files/cscope-15.5-tempfile.patch b/dev-util/cscope/files/cscope-15.5-tempfile.patch
new file mode 100644 (file)
index 0000000..e6fed46
--- /dev/null
@@ -0,0 +1,77 @@
+diff -Naur ./cscope-15.5/src/global.h ./cscope-15.5/src/global.h
+--- ./cscope-15.5/src/global.h 2003-09-04 17:54:03.000000000 +0200
++++ ./cscope-15.5/src/global.h 2004-11-19 13:19:18.000000000 +0100
+@@ -241,7 +241,7 @@
+ extern        long    totalterms;     /* total inverted index terms */
+ extern        BOOL    trun_syms;      /* truncate symbols to 8 characters */
+ extern        char    tempstring[8192]; /* global dummy string buffer */
+-extern        char    *tmpdir;        /* temporary directory */
++extern        char    tmpdir[2048];   /* temporary directory */
+ /* command.c global data */
+ extern        BOOL    caseless;       /* ignore letter case when searching */
+diff -Naur ./cscope-15.5/src/main.c ./cscope-15.5/src/main.c
+--- ./cscope-15.5/src/main.c   2003-08-14 16:36:18.000000000 +0200
++++ ./cscope-15.5/src/main.c   2004-11-19 13:31:26.000000000 +0100
+@@ -105,7 +105,7 @@
+ BOOL  trun_syms;              /* truncate symbols to 8 characters */
+ char  tempstring[8192];       /* use this as a buffer, instead of 'yytext', 
+                                * which had better be left alone */
+-char  *tmpdir;                /* temporary directory */
++char  tmpdir[2048];           /* temporary directory */
+ static        BOOL    onesearch;              /* one search only in line mode */
+ static        char    *reflines;              /* symbol reference lines file */
+@@ -312,8 +312,18 @@
+       shell = mygetenv("SHELL", SHELL);
+       lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG);
+       lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE")?1:0;
+-      tmpdir = mygetenv("TMPDIR", TMPDIR);
++      char template[] = "cscope.XXXXXX";
++      snprintf(tmpdir, sizeof(tmpdir), "%s/%s", mygetenv("TMPDIR", TMPDIR), template);
++      tmpdir[sizeof(tmpdir)-1] = '\0';
++      char *ret;
++      ret = mkdtemp(tmpdir);
++      if (ret == NULL)
++      {
++              fprintf (stderr, "cscope: Temporary directory %s cannot be created.\n", tmpdir);
++              myexit(1);
++      }
++      
+       /* XXX remove if/when clearerr() in dir.c does the right thing. */
+       if (namefile && strcmp(namefile, "-") == 0 && !buildonly)
+       {
+@@ -331,8 +341,10 @@
+       /* create the temporary file names */
+       pid = getpid();
+-      (void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
+-      (void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
++      (void) snprintf(temp1, sizeof(temp1), "%s/cscope%d.1", tmpdir, pid);
++      temp1[sizeof(temp1)-1] = '\0';
++      (void) snprintf(temp2, sizeof(temp1), "%s/cscope%d.2", tmpdir, pid);
++      temp2[sizeof(temp2)-1] = '\0';
+       /* if running in the foreground */
+       if (signal(SIGINT, SIG_IGN) != SIG_IGN) {
+@@ -825,6 +837,7 @@
+ void
+ myexit(int sig)
+ {
++      int retval;
+       /* HBB 20010313; close file before unlinking it. Unix may not care
+        * about that, but DOS absolutely needs it */
+       if (refsfound != NULL)
+@@ -834,6 +847,10 @@
+       if (temp1[0] != '\0') {
+               (void) unlink(temp1);
+               (void) unlink(temp2);
++              if (retval = rmdir(tmpdir) != 0)
++              {
++                      fprintf(stderr, "error deleting %s\n", tmpdir);
++              }
+       }
+       /* restore the terminal to its original mode */
+       if (incurses == YES) {
+
diff --git a/dev-util/cscope/files/digest-cscope-15.5-r3 b/dev-util/cscope/files/digest-cscope-15.5-r3
new file mode 100644 (file)
index 0000000..99cb973
--- /dev/null
@@ -0,0 +1 @@
+MD5 beb6032a301bb11524aec74bfb5e4840 cscope-15.5.tar.gz 243793