Commit Graph

3257 Commits

Author SHA1 Message Date
christos
29494835fd fix constness (from kre) 2016-03-21 02:37:26 +00:00
christos
db56d5516c Move the command substitution "internal subroutine" part of
readtoken1() into a real function of its own (inspired by a
similar change made by FreeBSD - the other internal routines
they moved out are expected to move out here as well soon.)
This change helps avoid gcc 5.3 demanded (not required!) volatile
noise which would slow down parsing. (from kre)
2016-03-20 22:56:39 +00:00
christos
fc55d6ef49 sprinkle more volatile (needed for the rescue build with gcc-5.3) 2016-03-18 18:07:28 +00:00
christos
9c9fb684e0 s/sed/${SED}/ 2016-03-17 13:59:02 +00:00
christos
c6f7781d4f put back the complex sed/awk since the code can't handle unsorted or repeated
entries (Rin Okuyama)
2016-03-17 13:54:31 +00:00
christos
1a51ba6b13 Put back awk, other scripts need it. 2016-03-16 23:02:23 +00:00
christos
702bd67153 We don't need all this magic to build the signals lists. Do the work at
compile time.
2016-03-16 23:01:33 +00:00
christos
90f49946eb Sprinkle volatile for gcc 5! 2016-03-16 22:36:40 +00:00
christos
e448e849b1 Avoid warning by using gcc'ism 2016-03-16 22:36:21 +00:00
christos
c1d7b11ef3 add Will Robinson comment. 2016-03-16 22:35:44 +00:00
christos
b4f0f90a59 Avoid gcc-5 conversion warning (|= expands to int) 2016-03-16 22:25:05 +00:00
christos
0c73873e5c Keep redirs for subshells. 2016-03-16 21:20:59 +00:00
christos
3b6be3a09c parenthesize for safety. 2016-03-16 19:02:26 +00:00
christos
6f9ac0be1e Remove wrong unsigned cast, index can be negative. Cast char to int so that
gcc does not warn. Probably better to do the offset at runtime, but that
would cost more.
2016-03-16 17:01:39 +00:00
christos
58a5df4203 factor out common code in macro. 2016-03-16 15:48:01 +00:00
christos
5f0a664efb Revert (kind of) the change in 1.12 of the ancient mksyntax.sh script
(undoing the effect of that commit on syntax.h when it was
being dynamically generated) from 1996.   This means that the shell
parser is now locale independent, so scripts that work anywhere will
work consistently everywhere.   Inspired by a similar change in
FreeBSD's sh (from 2010) - the original change in the other direction
came from FreeBSD as well....   Note that this does not in any way
add any kind of support for locales to sh (which is a whole different
problem.) (from kre)
2016-03-16 15:45:40 +00:00
christos
8c844a2ebd PR/19832, PR/35423: Fix handling 0x81 and 0x82 characters in expansions
($VAR etc) that are used to generate filenames for redirections. (from kre)
2016-03-16 15:44:35 +00:00
christos
5b34482515 PR/50960: The || and && operators in $(( )) should always have a 0 or 1
result, never anything different. (from kre)
2016-03-16 15:43:38 +00:00
christos
9815d7fee4 PR/50958: (partial fix) - support ?: expressions in arith expansions
(from kre)
2016-03-16 15:42:33 +00:00
christos
fc1f924a3b PR bin/50959 - allow consistent use of 0X hex constants (not just 0x)
(from kre)
2016-03-16 15:41:55 +00:00
christos
2baec48ec5 We want this to work too:
$ cat sep1
	#!/bin/sh
	{ ./sep2; } 3>out

	$ cat sep2
	#!/bin/sh
	echo sep2 >&3

	$ ./sep1
2016-03-13 15:57:30 +00:00
christos
e47a2585c4 dedup. 2016-03-13 01:22:42 +00:00
christos
284daf11ca Test for REDIR_KEEP in the non-copy case:
$ cat other1
	#!/bin/sh
	./other2 3>out

	$ cat other2
	#!/bin/sh
	echo other2 1>&3

	$ ./other1
2016-03-13 00:52:05 +00:00
christos
5047abd140 Don't close-on-exec redirections created explicitly for the command being
ran; i.e. we want this to work:
	$ cat succ1
	#!/bin/sh
	./succ2 6>out

	$ cat succ2
	#!/bin/sh
	echo succ2 >&6

	$ ./succ1

And this to fail:
	$ cat fail1
	#!/bin/sh
	exec 6> out
	echo "fail1" >&6
	./fail2
	exec 6>&-

	$ cat fail2
	#!obj.amd64/sh
	echo "fail2" >&6

	$ ./fail1
	./fail2: 6: Bad file descriptor

XXX: Do we want a -k (keep flag on exec to make redirections not close-on-exec?
2016-03-12 21:35:13 +00:00
christos
f87bc150c8 Improve quoting in the output from sh -x - use less unnecessary
quotes ('_' and '.' do not need quoting) and never quote the '=' in
an assignment (or it would not be one.) From kre, with some refactoring
to be blamed to me.
2016-03-12 14:59:26 +00:00
christos
1dd2c2fdec Move the PPID installation to the init() section. 2016-03-08 23:24:51 +00:00
christos
40cc189704 avoid duplicate includes (from kre) 2016-03-08 23:23:31 +00:00
christos
2c7c3a0713 - don't export $PPID (from kre)
- include <stdio.h>
2016-03-08 18:16:11 +00:00
christos
ae3fe60ef5 Provide $PPID, kill vvers (unused) 2016-03-08 14:32:34 +00:00
christos
65639a43f1 put back some volatile, gcc complains (x86_64) 2016-03-08 14:11:56 +00:00
christos
b506e0ff4c Remove most volatility from readtoken1() restoring execution
speed to approximately where it was before the changes made
in version 1.96 (which assumed this would eventually happen.)
2016-03-08 14:10:04 +00:00
christos
dec2ca90b9 PR bin/50834o: fix expansions of (unquoted) ${unset_var-} and ""$@ (from kre) 2016-03-08 14:09:07 +00:00
christos
bff14f8dfa PR bin/50896: make shift with more than 1 arg give a usage message, from kre 2016-03-08 14:08:39 +00:00
uwe
0d7369c54b The '-i' flag should work regardless of whether the standard input is
a terminal.  The Open Group notes this historic behavior and correctly
notes that it doesn't make much sense.  Note also, that mv(1) has
always respected its '-i' regardless of whether the standard input is
a terminal.

From Timo Buhrmester.
2016-03-05 19:48:55 +00:00
kamil
6b1cac1128 Correct display of df(1) with the -i parameter
Now the "Mounted on" column should be aligned with /entries.

Patch by Michal Mazurek.
2016-03-05 08:15:01 +00:00
christos
fa7bb8d201 PR/50879: David Binderman: remove redundant code. 2016-03-02 19:11:28 +00:00
martin
5902f7d619 Fix wrong condition in previous causing bogus 'Use "exit" to leave
shell.' messages (from kre)
2016-03-01 21:10:40 +00:00
christos
476468ab31 Even more debugging improvements (from kre) 2016-02-29 23:52:04 +00:00
christos
a584b40f8d Complete implementation of the noexec option (-n) including
disabling noexec, if the shell is interactive, each time that
a new command is about to be read.  Also correct the -I
(ignoreeof) option so that it only applies to interactive shells,
as required by posix. (from kre)
2016-02-29 23:51:36 +00:00
christos
8cfa226b64 delete clauses 3,4 2016-02-29 23:50:59 +00:00
mrg
9bb33dce89 for display in the (post) SIGINFO handler use off_t not size_t for
file sizes.  fixes incorrect reporting errors on 32 bit platforms
with >4GB file sizes.
2016-02-29 04:22:21 +00:00
christos
0c52b5f165 Bug fixes to handling of unterminated here documents
(they should be, and now are, a syntax error), and
miscellaneous other minor cleanups. (from kre)
2016-02-28 23:12:23 +00:00
mrg
0f6eb69275 add SIGINFO for mv(1), largely based upon the support in cp(1). 2016-02-28 10:59:29 +00:00
christos
ed090bddf8 More nodenames fixes. 2016-02-27 23:50:13 +00:00
christos
bc8cfb7d77 Improve debugging, from kre (I hooked it to the build). 2016-02-27 18:34:12 +00:00
christos
78204bbf10 remove useless casts 2016-02-27 16:28:50 +00:00
christos
d73fcc53c6 CID 1354293: handle EOF 2016-02-27 16:23:22 +00:00
wiz
4cf0de9860 file system police. 2016-02-24 15:28:36 +00:00
christos
8b2383fc90 PR/46327: David Mandelberg: Fix exit codes of background jobs (from kre) 2016-02-24 14:57:12 +00:00
christos
59f04ac937 Simple script to create node names for debugging 2016-02-24 14:51:20 +00:00