• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3826 (tree)
Time2018-03-04 13:06:13
Authormagicant

Log Message

Restore positional parameters on dot built-in error

The dot built-in was forgetting to close the temporary variable
environment on a file-not-found error.

Change Summary

Incremental Difference

--- yash/trunk/NEWS (revision 3825)
+++ yash/trunk/NEWS (revision 3826)
@@ -15,6 +15,8 @@
1515 disambiguate presence of special characters.
1616 = When the shell prints aliases, variables, key bindings, etc. they
1717 are now printed with less quotes.
18+ * The "." built-in no longer leaves temporary positional parameters
19+ after a file-not-found error.
1820
1921 ----------------------------------------------------------------------
2022 Yash 2.46
--- yash/trunk/exec.c (revision 3825)
+++ yash/trunk/exec.c (revision 3826)
@@ -1958,11 +1958,6 @@
19581958 path = mbsfilename;
19591959 }
19601960
1961- if (has_args) {
1962- open_new_environment(false);
1963- set_positional_parameters(&argv[xoptind]);
1964- }
1965-
19661961 int fd = move_to_shellfd(open(path, O_RDONLY));
19671962 if (path != mbsfilename)
19681963 free(path);
@@ -1971,6 +1966,11 @@
19711966 goto error;
19721967 }
19731968
1969+ if (has_args) {
1970+ open_new_environment(false);
1971+ set_positional_parameters(&argv[xoptind]);
1972+ }
1973+
19741974 execstate_T *saveexecstate = save_execstate();
19751975 reset_execstate(false);
19761976
Show on old repository browser