1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-07 01:30:59 +02:00
Commit graph

395 commits

Author SHA1 Message Date
Daniel Shahaf
e94e828efd 45583/0001: internal: Remove a redundant assignment.
The value is overwritten five lines below, without being read in the interim.
2020-03-22 02:23:52 +00:00
Daniel Shahaf
6fc8e8628f Merge remote-tracking branch 'origin/master' into 5.9
* Test/D02glob.ztst:
  On the "unreadable directories can be globbed (users/24619, users/24626)"
  test, resolve conflicts by removing the Cygwin-only skip that has been added
  in master, since the test is passing on this branch.  This effectively reverts
  workers/45492.  See discussion starting in workers/45504.

* origin/master:
  unposted: Remove 'sgi', as that OpenBSD port has been discontinued.
  45509: fix typos in B01cd.ztst
  45490 (+45495 and a test): refactor rlimits.c
  github : Fix typo: longson should be loongson
  users/24710: Fix job control problem with sudo.
  45492: skip test added by users/24633 on Cygwin
  45488: COMP_WORDS for bash need "$@"-style quoting
  45487: Missing mod_export declarations for AIX
  45447: Complete vcs_info_hookadd and vcs_info_hookdel. Expose _vcs_info_hooks as a top-level helper function.
  45463: test: kill: Document why we use SIGURG
  45453: builtins: kill: Do not signal current process group when pid is empty
  45452: builtins: kill: Add `kill ''` regression test with explicit sigspec
  45451: builtins: kill: Add basic test suite
  github #48/0002: vcs_info git: properly detect bare repositories
  github #48/0001: vcs_info git: avoid warnings in bare repositories
  unposted: Post-release version bump
  unposted: Release 5.8
  CVE-2019-20044: Update change log for preceding commits
  Update NEWS/README
  Add unsetopt/PRIVILEGED tests
  Clean up error-message white space
  Improve PRIVILEGED fixes (again)
  Improve PRIVILEGED fixes
  Drop privileges securely
  unposted: V01zmodload: Fix failing test from workers/45385
  45423: _su: Improve arg handling, shell look-ups
  unposted: _zip: Recognise '--'
  45385: Add a test for 'zmodload -Fa' preemptively disabling ("blacklisting"?) features.
  unposted: Test release: 5.7.1-test-3
  zsh/system: Fix infinite loop in sysread
  _diff_options: Restore -w completion lost in workers/43351
  unposted: Fix ChangeLog typo.
  45368: Add tests for workers/45367's issue about double slashes in 'cd -P' and /home/daniel/in/zsh.
  45373: Fix ERR_EXIT bug in else branch of if.
  45372: Record a symlink loop bug involving :P
  45365: _git: Fix __git_recent_branches for the case when a commit has an empty message
  45343: Queue signals around arithmetic evaluations
  45344: Document where third-party completion functions should be installed.
  45345: internal: ztst.vim: Fix highlighting of zsh comments in test payload
  unposted: internal: Add some comments and fix indentation.  No functional change.
  45340: internal: Document the difference between paramtab and realparamtab.
  45332: _git: add completion for git-version
  _brace_parameter: add missing \

Conflicts:
	ChangeLog
	Test/D02glob.ztst
	Test/V01zmodload.ztst
2020-03-07 21:36:46 +00:00
Peter Stephenson
14ea665a90 users/24710: Fix job control problem with sudo.
If we use kill to test for continued existence of a process group,
we should check on failure that the error is ESRCH, as EPERM
indicates the group still has memebers but running privileged
so should be left alone.
2020-02-27 20:42:16 +00:00
Daniel Shahaf
581585dfc6 45343: Queue signals around arithmetic evaluations
The queueing added in execarith() in 45083 is reverted since the callee
does this now.
2020-01-29 09:02:49 +00:00
Daniel Shahaf
ca6f4466e6 45131: Make a function that redefines itself preserve its tracedness.
This makes it easy to apply local tracing ('functions -T') to autoloadable
functions that redefines themselves when first loaded.
2019-12-26 04:20:10 +00:00
Peter Stephenson
fd068221b7 45083: Add signal protection to execarith().
Otherwise we could get re-entrancy in memory functions when
setting variables.
2019-12-18 10:51:59 +00:00
Daniel Shahaf
ae7e291873 45066: internal: Document forklevel, locallevel, and exit_pending. 2019-12-18 06:01:50 +00:00
Daniel Shahaf
8bc4400762 45058: internal: Add symbolic names to possible values of zexit()'s "from_where" parameter. No functional change. 2019-12-17 05:12:36 +00:00
Peter Stephenson
1baf0d1f55 45025: fix re-entrancy problem with memory management in readoutput().
This could cause a signal received during $(...) to corrupt memory.
2019-12-15 19:04:04 +00:00
Martijn Dekker
c578f0a08b 45004: Fix typos in comments 2019-12-11 02:37:39 +00:00
_RuRo_ (Андрей Стоцкий)
59901e61cb 44841: Better checking of errors from "nice" 2019-10-16 17:41:41 +01:00
Peter Stephenson
e0d063a2ad 44635: Don't apply STAT_NOPRINT to backgrounded jobs 2019-08-03 19:48:18 +01:00
Peter Stephenson
3bdf4d6641 44480: Don't automatically close externally visible file descroptors.
These are descriptors marked FDT_EXTERNAL.

Make all sysopen'ed file descriptors FDT_EXTERNAL.

Make =(...) call closem() consistent with other substitutions.

Document file descriptors are left open.
2019-07-02 13:42:53 +01:00
Oliver Kiddle
3de2333b08 44307: allow for atoi() returning a negative number 2019-05-20 00:14:01 +02:00
Eric Freese
5c165453ab 44214: <(...) substitutions shouldn't grab the terminal 2019-04-10 09:44:58 +01:00
Charles Blake
084bf17c4b 44132: don't hash commands beginning with / 2019-03-19 14:09:50 +00:00
Kamil Dudka
d1095bdf74 43723: file descriptor could leak on fork error 2018-11-09 11:02:24 +00:00
Peter Stephenson
bbccbe0c85 43660: extend 43653 when final exit is implicit.
Combine logic for case after committed to exit (shell_exiting) with
case where exit occurred in a function we nee to unwind (exit_pending).

Add sarky note for future generations to be confused at.
2018-10-09 14:38:26 +01:00
Daniel Shahaf
db67cc2f4b 43489: Add error checking on a new write() call.
Silences a compiler warning (write(2) is declared with warn_unused_result
in current Debian Unstable).
2018-09-25 19:35:15 +00:00
Peter Stephenson
551ff84272 43464: Another attachtty() fix.
If list_pipe_job triggered more than once we need to know
the most recent process group leader, so record that
both if the attach happened in the main shell on in
entersubsh().

Also don't pass back proocess group for ESUB_ASYNC subshells.
2018-09-16 19:13:38 +01:00
Peter Stephenson
7c5241edf3 43446: More entersubsh() / addproc() wiring.
Fix additional races by passing back use of list_pipe_job
from subshell.
2018-09-12 09:22:10 +01:00
Peter Stephenson
0d5275c6b9 43409: Fix process group setting in main shell.
A newly forked subshell now reports back the process group it
will be using for the main shell to record.

This prevents an error where the shell incorrectly thought an
exiting process owned the terminal and so grabbed it back,
putting the foreground process into the background.
2018-09-07 17:49:35 +01:00
Anthony Sottile
1c4c7b6a4d
CVE-2018-0502, CVE-2018-13259: Fix two security issues in shebang line parsing.
See NEWS for more information.

Patch by Anthony Sottile and Buck Evan.
2018-09-03 15:07:47 +00:00
Peter Stephenson
3e9fc32fc3 43156, 43157: Need to allow for extra space in gethere().
The point can now increment twice per iteration.
2018-07-10 14:42:02 +01:00
Peter Stephenson
17178db1a4 users/23531: Error exit/return fixes.
Fix regression with trap on left hand side of pipe.

Fix forced return from shell structure within nested function.

Fix tests exiting too early.

Add new test case.
2018-07-09 11:07:53 +01:00
Peter Stephenson
9408c4825b users/23472: Add $sysparams[procsubstpid] to zsh/system 2018-06-15 15:02:36 +01:00
dana
805192311f 42101 (tweaked): assigning shell status to array was broken 2018-05-11 09:29:14 +01:00
Peter Stephenson
faf0035e53 unposted (branch fork_early): Fork early for pipelines.
If executing a command not at the end of a pipeline, and
not optimised in the calling code, we can fork before
"prefork" substitutions, at the same point as
for background commands.

Move fork before our preliminary scan of arguments to find
a command: in the cases of early fork
we don't need this information before forking.

Ensure we _exit if forked in execcmd_exec().

Rationalise use of forks and pipes.

Ensure we _exit instead of returning from execcmd_exec() if we
have forked.  Before the optimisation code after the fork always ran
to the check at the end, but that code is overkill for the logic
between the early fork and the existing one.

Remove old workaround to fork in caller of execcmd for current shell
constructs as no longer needed with early fork below.

Close input of newly created pipe on fork (destined for RHS of pipe
which we never execute): this replaces a workaround from
zsh-workers/32171, commit 9887fc3d7b.

Set last1 on early fork as needed by some instances of shell
constructs on LHS of pipeline to know they are exiting.
2018-05-01 10:27:35 +01:00
Ricardo Giorni
f7519811e1 47201: fix 42355 for multiple backslashes 2018-04-29 12:05:39 -07:00
Daniel Shahaf
76b5b3a504 unposted: Correct process substitution buffer size in the PATH_DEV_FD codepath. 2018-04-25 15:31:39 +00:00
Peter Stephenson
95d861d028 42708: fix for process substitution.
Don't close associated file descriptors in the closem()
tidy up function as they should remain visible to external
processes.  Override if about to exit.

Unit test for the failing case: note this relies on the
existence of /proc/self/fd or equivalent.
2018-04-24 11:48:11 +01:00
Peter Stephenson
9e2afb9298 42684 (with extra comments): Fork early if in bg.
In execcmd the case of running the last command in a pipeline
asynchronously for the purpose of & and &! is easy to work out,
and we can avoid side effects and unnecessary execution time in
the parent shell by forking earlier.
2018-04-20 10:36:39 +01:00
Peter Stephenson
3c74891fcd 42630: Improve process group handling in pipelines.
If process group leader exits, allow a newly forked process to become
process leader.  If a foreground job, reattach the shell to the
terminal until that happens.

Unblock signals when reading output for command subsitution so that
we can do this reattaching immediately.
2018-04-17 17:14:20 +01:00
Oliver Kiddle
65b265f3c0 42624 (plus test): avoid freeing memory that's still needed
This was occurring in a multiple function definition where a
function name is duplicated.
2018-04-12 23:15:29 +02:00
Oliver Kiddle
679b71ec4d 42518, CVE-2018-1071: check bounds when copying path in hashcmd() 2018-03-24 15:04:02 +01:00
Stephane Chazelas
d2350a1e80 42469: necessary repairs to 42465 found by "make check" 2018-03-18 16:49:42 -07:00
Stephane Chazelas
1219eae829 42465: Pass up error status from readoutput().
This improves the consistency of error reporting from $(...) constructs.
2018-03-15 09:21:47 +00:00
Peter Stephenson
47aa60950c 42355: Fix use of backslashes on here doc input.
Handling of white space in particular was confusing and inconsistent
with other shells.
2018-02-12 10:06:45 +00:00
Barton E. Schaefer
b476d89fa2 42043: ZSH_DEBUG_CMD should not WARN_CREATE_GLOBAL 2018-01-14 03:07:32 -08:00
Peter Stephenson
8ec3d17b4b 33395: Improvments for function managment.
Functions defined inside other fucntions needs file line number
adding.  Particularly useful for anonymous fucntions.

Add flag to indicate a function is anonymous.  Done up to now
by comparing the name to a pointer but this is more consistent.
2017-12-22 19:51:04 +00:00
Daniel Shahaf
a9e60dc179 users/13148 (and workers/42060): Abort the command line when replying
"[n] No" to the RM_STAR_SILENT prompt.

Patch by Stephane, rebased by Mikael.
2017-12-20 04:13:01 +00:00
Peter Stephenson
aab0f6d763 42123 (tweaked): take account of Dash in function names.
Needed when comparing word code function name with autoload request.

Add test.
2017-12-15 09:00:37 +00:00
Peter Stephenson
e573857a03 41802 (minor tweaks): use heap during shell function call.
Replaces stack for more efficient memory management.

Also fix debug message when FUNCNEST is increased.
2017-10-04 09:18:51 +01:00
Peter Stephenson
174e560a23 41787 (plus minor tweaks): use $FUNCSTACK for function nesting depth.
Initialised from existing configuration value.
2017-10-02 09:44:26 +01:00
Peter Stephenson
a1276c88e1 41789: Don't save fd if -1.
We try to move an fd which isn't opend but it will feel.
This needs handling specially in the new code for marking
saved fd's.
2017-09-29 16:29:49 +01:00
Barton E. Schaefer
7a0718796a 41767: preserve nonzero exit status on interrupt 2017-09-27 20:34:11 -07:00
Peter Stephenson
03af5fdbee 41761: Ensure status from interrupt is propagated by builtin 2017-09-26 09:26:57 +01:00
Peter Stephenson
85b0dd7133 Updates for ksh array element syntax.
Move detection of key/value pairs down into prefork().

Detect normal array assignment and [key]=val array assignemnt
separately.  Mark key / value pairs with Marker and pass up flag.  Deal
with marked triads specially later on.
2017-09-24 17:33:07 +01:00
Barton E. Schaefer
d1914c5af4 41736: NO_INTERACTIVE_COMMENTS in $(...) 2017-09-20 10:17:59 -07:00
Peter Stephenson
54b3958440 First go at var=([key]=value) syntax.
Works for both normal and typeset case, also var+=...

Still to do: allow to be mixed with straight array assignment,
improve typeset -p, implement [key]+=value.
2017-09-13 20:54:00 +01:00