mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-31 23:20:45 +02:00
fix for %P in TIMEFORMAT; make updating variables that aren't subject to allexport smoother; fix spurious compiler warning about realloc; efficiency improvement for command timing; fix issue with read builtin and failure to set terminal attributes
This commit is contained in:
+2
-4
@@ -622,8 +622,7 @@ read_builtin (WORD_LIST *list)
|
||||
termsave.attrs = ttattrs;
|
||||
|
||||
ttset = ttattrs;
|
||||
i = silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset);
|
||||
if (i < 0)
|
||||
if ((silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset)) < 0)
|
||||
sh_ttyerror (1);
|
||||
tty_modified = 1;
|
||||
add_unwind_protect (uw_ttyrestore, &termsave);
|
||||
@@ -639,8 +638,7 @@ read_builtin (WORD_LIST *list)
|
||||
termsave.attrs = ttattrs;
|
||||
|
||||
ttset = ttattrs;
|
||||
i = ttfd_noecho (fd, &ttset); /* ttnoecho (); */
|
||||
if (i < 0)
|
||||
if (ttfd_noecho (fd, &ttset) < 0)
|
||||
sh_ttyerror (1);
|
||||
|
||||
tty_modified = 1;
|
||||
|
||||
+5
-14
@@ -532,7 +532,7 @@ set_shellopts (void)
|
||||
{
|
||||
char *value;
|
||||
char tflag[N_O_OPTIONS];
|
||||
int i, *ip, exported;
|
||||
int i, *ip;
|
||||
size_t vsize, vptr;
|
||||
SHELL_VAR *v;
|
||||
|
||||
@@ -571,21 +571,12 @@ set_shellopts (void)
|
||||
vptr--; /* cut off trailing colon */
|
||||
value[vptr] = '\0';
|
||||
|
||||
v = find_variable ("SHELLOPTS");
|
||||
/* ASS_FORCE so we don't have to temporarily turn off readonly; ASS_NOEXPORT
|
||||
so we don't have to work around allexport. */
|
||||
v = bind_variable ("SHELLOPTS", value, ASS_FORCE|ASS_NOEXPORT);
|
||||
|
||||
/* Note whether or not the variable was exported so we can adjust after the
|
||||
assignment. */
|
||||
exported = v ? exported_p (v) : 0;
|
||||
|
||||
/* ASS_FORCE so we don't have to temporarily turn off readonly */
|
||||
v = bind_variable ("SHELLOPTS", value, ASS_FORCE);
|
||||
|
||||
/* Turn the read-only attribute back on, and turn off the export attribute
|
||||
if it was set implicitly by mark_modified_vars and SHELLOPTS was not
|
||||
exported before we bound the new value. */
|
||||
/* Turn the read-only attribute back on. */
|
||||
VSETATTR (v, att_readonly);
|
||||
if (mark_modified_vars && exported == 0 && exported_p (v))
|
||||
VUNSETATTR (v, att_exported);
|
||||
|
||||
free (value);
|
||||
}
|
||||
|
||||
+4
-11
@@ -823,7 +823,7 @@ set_bashopts (void)
|
||||
{
|
||||
char *value;
|
||||
char tflag[N_SHOPT_OPTIONS];
|
||||
int i, exported;
|
||||
int i;
|
||||
size_t vsize, vptr;
|
||||
SHELL_VAR *v;
|
||||
|
||||
@@ -853,21 +853,14 @@ set_bashopts (void)
|
||||
vptr--; /* cut off trailing colon */
|
||||
value[vptr] = '\0';
|
||||
|
||||
v = find_variable ("BASHOPTS");
|
||||
|
||||
/* Note whether or not the variable was exported so we can adjust after the
|
||||
assignment. */
|
||||
exported = v ? exported_p (v) : 0;
|
||||
|
||||
/* ASS_FORCE so we don't have to temporarily turn off readonly */
|
||||
v = bind_variable ("BASHOPTS", value, ASS_FORCE);
|
||||
/* ASS_FORCE so we don't have to temporarily turn off readonly; ASS_NOEXPORT
|
||||
so we don't have to work around allexport. */
|
||||
v = bind_variable ("BASHOPTS", value, ASS_FORCE|ASS_NOEXPORT);
|
||||
|
||||
/* Turn the read-only attribute back on, and turn off the export attribute
|
||||
if it was set implicitly by mark_modified_vars and SHELLOPTS was not
|
||||
exported before we bound the new value. */
|
||||
VSETATTR (v, att_readonly);
|
||||
if (mark_modified_vars && exported == 0 && exported_p (v))
|
||||
VUNSETATTR (v, att_exported);
|
||||
|
||||
free (value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user