]> git.pld-linux.org Git - packages/gawk.git/blob - gawk-newsecurity.patch
- release 6,
[packages/gawk.git] / gawk-newsecurity.patch
1 --- gawk-3.1.0/doc/gawk.texi.orig       Tue Jun 26 00:01:14 2001
2 +++ gawk-3.1.0/doc/gawk.texi    Tue Jun 26 00:13:40 2001
3 @@ -20336,8 +20336,7 @@
4  arranges to clean up any temporary files on program exit or upon an
5  interrupt.
6  
7 -@c 2e: For the temp file handling, go with Darrel's ig=${TMP:-/tmp}/igs.$$
8 -@c 2e: or something as similar as possible.
9 +@c 2e: For the temporary file handling, use mktemp with $@{TMPDIR:-/tmp@}.
10  
11  The next part loops through all the command-line arguments.
12  There are several cases of interest:
13 @@ -20358,13 +20357,13 @@
14  These are saved and passed on to @command{gawk}.
15  
16  @item -f@r{,} --file@r{,} --file=@r{,} -Wfile=
17 -The @value{FN} is saved to the temporary file @file{/tmp/ig.s.$$} with an
18 +The @value{FN} is saved to the temporary file with an
19  @samp{@@include} statement.
20  The @command{sed} utility is used to remove the leading option part of the
21  argument (e.g., @samp{--file=}).
22  
23  @item --source@r{,} --source=@r{,} -Wsource=
24 -The source text is echoed into @file{/tmp/ig.s.$$}.
25 +The source text is echoed into a temporary file.
26  
27  @item --version@r{,} -Wversion
28  @command{igawk} prints its version number, runs @samp{gawk --version}
29 @@ -20375,10 +20374,7 @@
30  or @option{-Wsource} arguments are supplied, then the first non-option argument
31  should be the @command{awk} program.  If there are no command-line
32  arguments left, @command{igawk} prints an error message and exits.
33 -Otherwise, the first argument is echoed into @file{/tmp/ig.s.$$}.
34 -In any case, after the arguments have been processed,
35 -@file{/tmp/ig.s.$$} contains the complete text of the original @command{awk}
36 -program.
37 +Otherwise, the first argument is echoed into a temporary file.
38  
39  @cindex @command{sed} utility
40  @cindex stream editor
41 @@ -20403,13 +20399,25 @@
42  @c endfile
43  @end ignore
44  @c file eg/prog/igawk.sh
45 +# Temporary file handling modifications for Owl by
46 +# Jarno Huuskonen and Solar Designer, still Public Domain
47 +# May 2001
48 +
49 +if [ ! -x /bin/mktemp ]; then
50 +    echo "$0 needs mktemp to create temporary files."
51 +    exit 1
52 +fi
53 +
54 +STEMPFILE=`/bin/mktemp $@{TMPDIR:-/tmp@}/igawk.s.XXXXXX` || exit 1
55 +ETEMPFILE=`/bin/mktemp $@{TMPDIR:-/tmp@}/igawk.e.XXXXXX` || exit 1
56 +
57  if [ "$1" = debug ]
58  then
59      set -x
60      shift
61  else
62      # cleanup on exit, hangup, interrupt, quit, termination
63 -    trap 'rm -f /tmp/ig.[se].$$' 0 1 2 3 15
64 +    trap 'rm -f $STEMPFILE $ETEMPFILE' EXIT HUP INT QUIT TERM
65  fi
66  
67  while [ $# -ne 0 ] # loop over arguments
68 @@ -20426,26 +20434,26 @@
69  
70      -[vF]*) opts="$opts '$1'" ;;
71  
72 -    -f)     echo @@include "$2" >> /tmp/ig.s.$$
73 +    -f)     echo @@include "$2" >> $STEMPFILE
74              shift;;
75  
76      -f*)    f=`echo "$1" | sed 's/-f//'`
77 -            echo @@include "$f" >> /tmp/ig.s.$$ ;;
78 +            echo @@include "$f" >> $STEMPFILE ;;
79  
80      -?file=*)    # -Wfile or --file
81              f=`echo "$1" | sed 's/-.file=//'`
82 -            echo @@include "$f" >> /tmp/ig.s.$$ ;;
83 +            echo @@include "$f" >> $STEMPFILE ;;
84  
85      -?file)      # get arg, $2
86 -            echo @@include "$2" >> /tmp/ig.s.$$
87 +            echo @@include "$2" >> $STEMPFILE
88              shift;;
89  
90      -?source=*)  # -Wsource or --source
91              t=`echo "$1" | sed 's/-.source=//'`
92 -            echo "$t" >> /tmp/ig.s.$$ ;;
93 +            echo "$t" >> $STEMPFILE ;;
94  
95      -?source)    # get arg, $2
96 -            echo "$2" >> /tmp/ig.s.$$
97 +            echo "$2" >> $STEMPFILE
98              shift;;
99  
100      -?version)
101 @@ -20460,7 +20468,7 @@
102      shift
103  done
104  
105 -if [ ! -s /tmp/ig.s.$$ ]
106 +if [ ! -s $STEMPFILE ]
107  then
108  @group
109      if [ -z "$1" ]
110 @@ -20469,12 +20477,12 @@
111           exit 1
112  @end group
113      else
114 -        echo "$1" > /tmp/ig.s.$$
115 +        echo "$1" > $STEMPFILE
116          shift
117      fi
118  fi
119  
120 -# at this point, /tmp/ig.s.$$ has the program
121 +# at this point, $STEMPFILE has the program
122  @c endfile
123  @end example
124  
125 @@ -20553,7 +20561,7 @@
126  @c endfile
127  @end example
128  
129 -The stack is initialized with @code{ARGV[1]}, which will be @file{/tmp/ig.s.$$}.
130 +The stack is initialized with @code{ARGV[1]}, which will be @file{$STEMPFILE}.
131  The main loop comes next.  Input lines are read in succession. Lines that
132  do not start with @samp{@@include} are printed verbatim.
133  If the line does start with @samp{@@include}, the @value{FN} is in @code{$2}.
134 @@ -20599,7 +20607,7 @@
135          @}
136          close(input[stackptr])
137      @}
138 -@}' /tmp/ig.s.$$ > /tmp/ig.e.$$
139 +@}' $STEMPFILE > $ETEMPFILE
140  @c endfile
141  @end example
142  
143 @@ -20625,7 +20633,7 @@
144  
145  @example
146  @c file eg/prog/igawk.sh
147 -eval gawk -f /tmp/ig.e.$$ $opts -- "$@@"
148 +eval gawk -f $ETEMPFILE $opts -- "$@@"
149  
150  exit $?
151  @c endfile
This page took 0.051935 seconds and 3 git commands to generate.