--- csh-20070713.orig/csh.h +++ csh-20070713/csh.h @@ -545,3 +545,14 @@ #endif Char *STR_WORD_CHARS; Char **STR_environ; + +#ifndef MAXPATHLEN +#define MAXPATHLEN BUFSIZ +#endif + +extern const char *const sys_sigabbrev[]; + +#include +#define fpurge __fpurge + +size_t strlcpy(char *, const char *, size_t); --- csh-20070713.orig/proc.c +++ csh-20070713/proc.c @@ -953,16 +953,22 @@ signum = atoi(short2str(v[1])); if (signum < 0 || signum >= NSIG) stderror(ERR_NAME | ERR_BADSIG); - else if (signum == 0) - (void) fputc('0', cshout); /* 0's symbolic name is '0' */ + else if (sys_sigabbrev[signum] == NULL) + (void) fprintf(cshout, "%d", signum); else - (void) fprintf(cshout, "%s ", sys_signame[signum]); + (void) fprintf(cshout, "%s ", sys_sigabbrev[signum]); } else { - for (signum = 1; signum < NSIG; signum++) { - (void) fprintf(cshout, "%s ", sys_signame[signum]); - if (signum == NSIG / 2) - (void) fputc('\n', cshout); - } + int cur = 0, len; + for (signum = 1; signum < NSIG; signum++) + if (sys_sigabbrev[signum]) { + len = strlen(sys_sigabbrev[signum]) + 1; + cur += len; + if (cur >= 80 - 1) { + (void) fputc('\n', cshout); + cur = len; + } + (void) fprintf(cshout, "%s ", sys_sigabbrev[signum]); + } } (void) fputc('\n', cshout); return; @@ -986,9 +992,10 @@ } for (signum = 1; signum < NSIG; signum++) - if (!strcasecmp(sys_signame[signum], name) || - (strlen(name) > 3 && !strncasecmp("SIG", name, 3) && - !strcasecmp(sys_signame[signum], name + 3))) + if (sys_sigabbrev[signum] && \ + (!strcasecmp(sys_sigabbrev[signum], name) || + (strlen(name) > 3 && !strncasecmp("SIG", name, 3) && + !strcasecmp(sys_sigabbrev[signum], name + 3)))) break; if (signum == NSIG) { --- csh-20070713.orig/Makefile +++ csh-20070713/Makefile @@ -7,12 +7,14 @@ PROG= csh DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS +DFLAGS+=-D_GNU_SOURCE -D__BSD_VISIBLE #CFLAGS+=-g #CFLAGS+=-Wall CFLAGS+=-I${.CURDIR} -I. ${DFLAGS} SRCS= alloc.c char.c const.c csh.c dir.c dol.c error.c exec.c exp.c file.c \ func.c glob.c hist.c init.c lex.c misc.c parse.c proc.c \ sem.c set.c str.c time.c +SRCS+= _glob.c _strlcpy.c _vis.c MLINKS= csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \ csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \ --- csh-20070713.orig/pathnames.h +++ csh-20070713/pathnames.h @@ -36,5 +36,5 @@ #define _PATH_DOTCSHRC "/etc/csh.cshrc" #define _PATH_DOTLOGIN "/etc/csh.login" #define _PATH_DOTLOGOUT "/etc/csh.logout" -#define _PATH_LOGIN "/usr/bin/login" +#define _PATH_LOGIN "/bin/login" #define _PATH_USRBIN "/usr/bin" --- csh-20070713.orig/_glob.c +++ csh-20070713/_glob.c @@ -347,7 +347,8 @@ * handle a plain ~ or ~/ by expanding $HOME * first and then trying the password file */ - if (issetugid() != 0 || (h = getenv("HOME")) == NULL) { + if ((getuid() != geteuid()) || (getgid() != getegid()) || + (h = getenv("HOME")) == NULL) { if ((pwd = getpwuid(getuid())) == NULL) return pattern; else --- csh-20070713.orig/vis.h +++ csh-20070713/vis.h @@ -76,14 +76,11 @@ __BEGIN_DECLS char *vis(char *, int, int, int); int strvis(char *, const char *, int); -int strnvis(char *, const char *, size_t, int) - __attribute__ ((__bounded__(__string__,1,3))); -int strvisx(char *, const char *, size_t, int) - __attribute__ ((__bounded__(__string__,1,3))); +int strnvis(char *, const char *, size_t, int); +int strvisx(char *, const char *, size_t, int); int strunvis(char *, const char *); int unvis(char *, char, int *, int); -ssize_t strnunvis(char *, const char *, size_t) - __attribute__ ((__bounded__(__string__,1,3))); +ssize_t strnunvis(char *, const char *, size_t); __END_DECLS --- csh-20070713.orig/csh.c +++ csh-20070713/csh.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -93,10 +94,11 @@ extern char **environ; -static int readf(void *, char *, int); -static fpos_t seekf(void *, fpos_t, int); -static int writef(void *, const char *, int); +static ssize_t readf(void *, char *, size_t); +static int seekf(void *, off64_t *, int); +static ssize_t writef(void *, const char *, size_t); static int closef(void *); +static cookie_io_functions_t cookief = {readf, writef, seekf, closef}; static int srccat(Char *, Char *); static int srcfile(char *, bool, bool); static void phup(int); @@ -201,14 +203,11 @@ * Fortunately this is not needed under the current implementation * of stdio. */ - (void) fclose(cshin); - (void) fclose(cshout); - (void) fclose(csherr); - if (!(cshin = funopen((void *) &SHIN, readf, writef, seekf, closef))) + if (!(cshin = fopencookie((void *) &SHIN, "r", cookief))) exit(1); - if (!(cshout = funopen((void *) &SHOUT, readf, writef, seekf, closef))) + if (!(cshout = fopencookie((void *) &SHOUT, "w", cookief))) exit(1); - if (!(csherr = funopen((void *) &SHERR, readf, writef, seekf, closef))) + if (!(csherr = fopencookie((void *) &SHERR, "w", cookief))) exit(1); (void) setvbuf(cshin, NULL, _IOLBF, 0); (void) setvbuf(cshout, NULL, _IOLBF, 0); @@ -1222,23 +1221,23 @@ */ #define DESC(a) (*((int *) (a)) - (didfds && *((int *) a) >= FSHIN ? FSHIN : 0)) -static int -readf(void *oreo, char *buf, int siz) +static ssize_t +readf(void *oreo, char *buf, size_t siz) { return read(DESC(oreo), buf, siz); } -static int -writef(void *oreo, const char *buf, int siz) +static ssize_t +writef(void *oreo, const char *buf, size_t siz) { return write(DESC(oreo), buf, siz); } -static fpos_t -seekf(void *oreo, fpos_t off, int whence) +static int +seekf(void *oreo, off64_t *off, int whence) { - return lseek(DESC(oreo), off, whence); + return lseek(DESC(oreo), (off_t) *off, whence); } --- csh-20070713.orig/debian/postinst +++ csh-20070713/debian/postinst @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +if [ "$1" = configure ]; then + update-alternatives --install /bin/csh csh /bin/bsd-csh 30 \ + --slave /usr/share/man/man1/csh.1.gz csh.1.gz \ + /usr/share/man/man1/bsd-csh.1.gz + + if type add-shell >/dev/null 2>&1; then + add-shell /bin/csh + fi +fi + +#DEBHELPER# --- csh-20070713.orig/debian/rules +++ csh-20070713/debian/rules @@ -0,0 +1,47 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk + +# Standard options minus `-Wall', since upstream uses `-Werror'. +export CFLAGS := -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2) + +# Make sure groff uses traditional (non-ANSI) escape sequences. +export GROFF_NO_SGR := 1 + +build/csh:: + pmake + cd USD.doc && pmake paper.ps paper.txt + +clean:: + pmake cleandir + cd USD.doc && pmake cleandir + +install/csh:: + install -D csh debian/csh/bin/bsd-csh + install -D -m 644 USD.doc/paper.txt debian/csh/usr/share/doc/csh/csh.txt + install -D -m 644 USD.doc/paper.ps debian/csh/usr/share/doc/csh/csh.ps + install -D -m 644 -p csh.1 debian/csh/usr/share/man/man1/bsd-csh.1 + +export CVSROOT := anoncvs@anoncvs.openbsd.org:/cvs +export CVS_RSH := ssh + +get-orig-source: + set -ex; \ + dir=`mktemp -d`; \ + ver=`date +%Y%m%d`; \ + cd "$$dir"; \ + cvs export -r HEAD src/bin/csh \ + src/include/glob.h src/lib/libc/gen/glob.c \ + src/lib/libc/string/strlcpy.c \ + src/include/vis.h src/lib/libc/gen/vis.c; \ + mv src/bin/csh csh-$$ver.orig; \ + for hdr in `find src -name \*.h`; do \ + mv $$hdr csh-$$ver.orig; \ + done; \ + for src in `find src -name \*.c`; do \ + mv $$src csh-$$ver.orig/_$${src##*/}; \ + done; \ + GZIP=-9 tar czf $(CURDIR)/csh_$$ver.orig.tar.gz csh-$$ver.orig; \ + rm -rf "$$dir" + +.PHONY: get-orig-source --- csh-20070713.orig/debian/prerm +++ csh-20070713/debian/prerm @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +if [ "$1" = remove ]; then + update-alternatives --remove csh /bin/bsd-csh + + if type remove-shell >/dev/null 2>&1; then + remove-shell /bin/csh + fi +fi + +#DEBHELPER# --- csh-20070713.orig/debian/compat +++ csh-20070713/debian/compat @@ -0,0 +1 @@ +5 --- csh-20070713.orig/debian/copyright +++ csh-20070713/debian/copyright @@ -0,0 +1,12 @@ +This is the Debian prepackaged version of BSD csh(1), originally put +together by Dominik Kubla , and subsequently updated +by Joey Hess , Edward Brocklesby , +Michael Stone , and Matej Vela . + +The original sources were retrieved from the OpenBSD CVS repository +(anoncvs@anoncvs.openbsd.org:/cvs). The upstream tarball can be +recreated using `debian/rules get-orig-source'. + +csh was written by William Joy et al. at the University of California at +Berkeley and is copyright (c) 1980-1993 by the Regents of the University +of California. Please see /usr/share/common-licenses/BSD for details. --- csh-20070713.orig/debian/changelog +++ csh-20070713/debian/changelog @@ -0,0 +1,235 @@ +csh (20070713-1) unstable; urgency=low + + * New upstream release. + * debian/menu: Move to Applications/Shells. + + -- Matej Vela Fri, 13 Jul 2007 23:52:21 +0200 + +csh (20060813-1) unstable; urgency=low + + * New upstream release. + * Switch to cdbs. + * csh.c, csh.h, debian/preinst: Remove potato compatibility code. + * debian/postinst: Invoke add-shell unconditionally, to handle the case + where the package is re-installed after being removed. + * Conforms to Standards version 3.7.2. + + -- Matej Vela Sun, 13 Aug 2006 15:53:42 +0200 + +csh (20060413-1) unstable; urgency=low + + * New upstream release. + * Since glibc is broken with respect to GLOB_NOMAGIC and backslashes + (and its maintainers refuse to see the light), switch back to BSD's + implementation of glob. Closes: #220170. + * Incidentally, this removes the need to reimplement glob_t.gl_matchc, + fixing a bug that was causing `No match' errors when some patterns did + match and some didn't. Closes: #350869. + * Prefix BSD libc sources (glob.c, strlcpy.c, vis.c) with an underscore + to avoid a conflict with our own glob.c. + * _glob.c (globtilde): Replace issetugid with calls to get{e,}{u,g}id. + * Use add-shell and remove-shell. Closes: #361544. + * Switch to debhelper 5. + * debian/copyright: Document `debian/rules get-orig-source'. + * debian/doc-base: Rephrase abstract. + * debian/rules: Set CVS_RSH to ssh. + * Conforms to Standards version 3.6.2. + + -- Matej Vela Thu, 13 Apr 2006 18:48:29 +0200 + +csh (20050313-1) unstable; urgency=low + + * New upstream release. + * Revert to a flat source tree, it does make things simpler. + * exp.c (exp2): Rename to csh_exp2 to avoid conflict with gcc builtin + (thanks to Andreas Jochens). Closes: #258588. + * glob.c (libglob): GLOB_NOMAGIC has been fixed in glibc 2.3 (#106097). + * proc.c (dokill): glibc has an undocumented sys_sigabbrev array with + signal names, so we no longer have to generate our own. + * vis.c (isvisible): Comparison with UCHAR_MAX triggers `always true' + warnings for unsigned char arguments; since this is already checked by + isascii, remove it. Closes: #268438. + * vis.h: Remove OpenBSD-specific `bounded' attribute. + * Switch to debhelper 4. + * debian/doc-base: Add doc-base support. + * debian/menu: Add menu file (thanks to Bill Allombert). Closes: #187629. + * debian/rules: + - Re-enable -Werror on alpha now that #97603 is fixed. + - Make sure groff uses traditional (non-ANSI) escape sequences. + - Remove support for DEB_BUILD_OPTIONS=debug. + - Add support for DEB_BUILD_OPTIONS=noopt. + * Conforms to Standards version 3.6.1. + + -- Matej Vela Sun, 13 Mar 2005 22:14:05 +0100 + +csh (20020413-1.1) unstable; urgency=high + + * Non-maintainer upload. + * Urgency=high for sarge-targetted RC bugfix. + * Fix implicit signed char assumptions in source, addressing FTBFS bugs + on arm/powerpc/s390 (closes: #268438). + + -- Steve Langasek Mon, 6 Sep 2004 19:31:44 -0700 + +csh (20020413-1) unstable; urgency=low + + * New upstream version. + * Removed the /usr/bin/csh compatibility symlink. Since /usr/bin + precedes /bin in the PATH, a configure script would use the former + location instead of the one managed by alternatives, and things + wouldn't work with tcsh (cf. #106547). Obviously, this doesn't break + anything that isn't already broken for tcsh. + + -- Matej Vela Sat, 13 Apr 2002 18:34:51 +0200 + +csh (20020213-1) unstable; urgency=low + + * New upstream version. Handles out of range argv subscripts. + Closes: #131693. + + -- Matej Vela Wed, 13 Feb 2002 23:03:47 +0100 + +csh (20011113-1) unstable; urgency=high + + * New upstream version. + * csh.c: On glibc (<< 2.2), call cookie_seek_function_t with an + off_t instead of an off64_t *. The package now builds on potato. + Closes: #119344. + * csh.c: Leave standard streams open for progprintf. + * csh.c, proc.c: Substitute fpurge with the recently added __fpurge. + * csh.h: On the Hurd, seems to define MAXPATHLEN to + PATH_MAX without defining the latter; provide a default. + * func.c (doprintf): progprintf uses stdout/stderr, so flush those + rather than cshout/csherr. + * pathnames.h (_PATH_LOGIN): login is in /bin, not /usr/bin. + + -- Matej Vela Tue, 13 Nov 2001 20:53:00 +0100 + +csh (20010813-1) unstable; urgency=high + + * New upstream version. + * debian/rules: stdio.h causes a cpp warning on alpha; conditionally + disable -Werror until #97603 is fixed. Closes: #106285. + * glob.c: GLOB_NOMAGIC produces false positives for patterns like + `*/xxx'; work around it until #106097 is fixed. + * Conforms to Standards version 3.5.6. + + -- Matej Vela Mon, 13 Aug 2001 20:33:24 +0200 + +csh (20010613-1) unstable; urgency=low + + * New upstream version. + * New maintainer. Closes: #92493. + * debian/prerm: `update-alternatives --remove' wants /bin/bsd-csh, not + /bin/csh. + * Conforms to Standards version 3.5.5. + + -- Matej Vela Wed, 13 Jun 2001 03:31:52 +0200 + +csh (20010413-1) unstable; urgency=medium + + * New upstream version, re-ported from OpenBSD-current: + * csh.c: Include for time_t etc. Closes: #90859. + * csh.c (main, readf, writef, seekf, closef): funopen substituted + with fopencookie. + * csh.c (pintr1), proc.c (pprint): fpurge substituted with fflush. + (Anything better?) + * csh.h: Define MAXPATHLEN to 4096 if it isn't already defined (e.g. + on the Hurd). If X11 and Tcl can get away with it, so can we. ;-) + Closes: #54993. + * glob.c (libglob): + * Don't set GLOB_QUOTE, it's already default. + * Work around gl_matchc, this time correctly. Closes: #88780. + * misc.c (closem): Upstream fixed it to use `sysconf (_SC_OPEN_MAX)' + rather than NOFILE. Closes: #63650. + * proc.c (dokill), proc.h, siglist.in: Use our own sys_signame + array, constructed from siglist.in (taken from pdksh 5.2.14). + * Package is orphaned (see #92493); maintainer set to Debian QA Group. + * Converted to debhelper. Closes: #91435. + * Conforms to Standards version 3.5.2: + * Added build dependencies. Closes: #90860. + * debian/rules: Support the `debug' build option. + * debian/copyright: Updated. + * Changed priority to optional, catching up with the override file. + * debian/lintian: Override the `binary-without-manpage: csh' Lintian + error caused by the /usr/bin/csh -> /bin/csh symlink. + * debian/rules: Added a `get-orig-source' target. + * Removed pre-bo (<< 5.26-6) compatibility code. + + -- Matej Vela Fri, 13 Apr 2001 20:43:09 +0200 + +csh (5.26-12) unstable; urgency=low + + * move csh to /bin/bsd-csh + + -- Michael Stone Tue, 2 Jan 2001 07:36:42 -0500 + +csh (5.26-11) unstable; urgency=low + + * New maintainer. + * Updated policy version + + -- Michael Stone Tue, 2 Jan 2001 06:59:11 -0500 + +csh (5.26-10) unstable; urgency=low + + * New maintainer. + + -- Edward Brocklesby Sat, 10 Jul 1999 11:12:48 -0700 + +csh (5.26-9) unstable; urgency=low + + * libc6 release. + * Several fixes (hacks really, for the most part) to get it to build on + libc6. + * Clean up const.h in debian/rules clean. + * Run dpkg-shlibdeps. + * Orphaned the package, now maintained by debian-qa. + + -- Joey Hess Thu, 20 Nov 1997 20:57:46 -0500 + +csh (5.26-8) stable unstable; urgency=HIGH + + * Added glob functions from 4.4BSD libc to work around missing BSD + compatibility in Linux libc. That fixes Bug#6501. + * Replaced manual page with newer one from NetBSD. This fixes Bug#5872. + * Changed Maintainer address to . + * Added USD manual "An Introduction to the C shell" from NetBSD. + This will be installed both as Latin-1 text and postscript file. + + -- Dominik Kubla Sat, 25 Jan 1997 14:41:04 +0100 + +csh (5.26-7) unstable; urgency=low + + * Minor bugfixes in debian/rules. Should now comply with "Debian Programmers + Manual", section 3.2.1 + + * manual page is now installed in 'gzip -9' format as per + "Debian Policy Manual", section 3.2.1 + + * changed priority from 'optional' to 'standard'. + + -- Dominik Kubla Mon, 30 Sep 1996 16:43:37 +0200 + +csh (5.26-6) unstable; urgency=low + + * Applied patches provided by Randy Gobbel to + fix a malloc and a string match bug. + + * copyright file is now installed in /usr/doc/csh/copyright as per + "Debian Policy Manual", Section 3.2.6 + + * Package is now compiled with CFLAGS set to '-O2 -g -Wall' as per + "Debian Policy Manual", Section 4.1 + + * csh does now use alternatives instead of diversions to coexist with + tcsh. Therefore it conflicts with tcsh <= 6.06-3 because tcsh does + not yet use alternatives. + + -- Dominik Kubla Sat, 28 Sep 1996 19:48:15 +0200 + +csh (5.26-5) unstable; urgency=low + + * Converted to new packaing standards. + + -- Dominik Kubla Thu, 12 Sep 1996 09:44:45 +0200 --- csh-20070713.orig/debian/doc-base +++ csh-20070713/debian/doc-base @@ -0,0 +1,17 @@ +Document: csh +Title: An Introduction to the C shell +Author: William Joy, Mark Seiden +Abstract: The C shell was originally written at UCB to overcome limitations + in the Bourne shell. Its flexibility and comfort (at that time) quickly + made it the shell of choice until more advanced shells like ksh, bash, zsh + or tcsh appeared. Most of the latter incorporate features original to csh. + . + This is a step-by-step tutorial on interactive use of the C shell. It is + mainly of historical interest. +Section: Apps/Shells + +Format: PostScript +Files: /usr/share/doc/csh/csh.ps.gz + +Format: text +Files: /usr/share/doc/csh/csh.txt.gz --- csh-20070713.orig/debian/control +++ csh-20070713/debian/control @@ -0,0 +1,18 @@ +Source: csh +Section: shells +Priority: optional +Maintainer: Matej Vela +Standards-Version: 3.7.2 +Build-Depends: cdbs, debhelper (>= 5), groff, pmake + +Package: csh +Architecture: any +Provides: c-shell +Depends: ${shlibs:Depends} +Description: Shell with C-like syntax, standard login shell on BSD systems + The C shell was originally written at UCB to overcome limitations in the + Bourne shell. Its flexibility and comfort (at that time) quickly made it + the shell of choice until more advanced shells like ksh, bash, zsh or + tcsh appeared. Most of the latter incorporate features original to csh. + . + This package is based on current OpenBSD sources. --- csh-20070713.orig/debian/menu +++ csh-20070713/debian/menu @@ -0,0 +1,6 @@ +?package(csh):\ + needs="text"\ + section="Applications/Shells"\ + longtitle="C shell"\ + title="Csh"\ + command="/bin/bsd-csh -l" --- csh-20070713.orig/exp.c +++ csh-20070713/exp.c @@ -67,6 +67,8 @@ #define EQMATCH 7 #define NOTEQMATCH 8 +#define exp2 csh_exp2 /* avoid conflict with gcc builtin */ + static int exp1(Char ***, bool); static int exp2(Char ***, bool); static int exp2a(Char ***, bool); --- csh-20070713.orig/_vis.c +++ csh-20070713/_vis.c @@ -36,7 +36,7 @@ #define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') #define isvisible(c) \ - (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \ + ((isascii((u_char)(c)) && \ (((c) != '*' && (c) != '?' && (c) != '[' && (c) != '#') || \ (flag & VIS_GLOB) == 0) && isgraph((u_char)(c))) || \ ((flag & VIS_SP) == 0 && (c) == ' ') || \