]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
fix for incomplete multibyte characters in pasted input; fix for syntax errors while...
authorChet Ramey <chet.ramey@case.edu>
Thu, 4 May 2023 15:19:43 +0000 (11:19 -0400)
committerChet Ramey <chet.ramey@case.edu>
Thu, 4 May 2023 15:19:43 +0000 (11:19 -0400)
16 files changed:
CWRU/CWRU.chlog
doc/bash.0
doc/bash.info
doc/bashref.info
eval.c
execute_cmd.c
input.c
jobs.c
jobs.h
lib/readline/text.c
lib/sh/strscpy.c
nojobs.c
parse.y
po/hr.gmo
po/hr.po
sig.c

index 49734eb5e2853f5667ba9e49f3442534b37851e5..9c287897f8ddf245772c55bc4750e164e16cee7b 100644 (file)
@@ -6191,4 +6191,69 @@ bashline.c
 lib/readline/histexpand.c
        - history_expand: don't read past the end of the string if it ends with
          an incomplete multibyte character
+         From a report by Grisha Levit <grishalevit@gmail.com>
+
+                                   5/1
+                                   ---
+lib/readline/text.c
+       - _rl_insert_char: make sure to return 1 in all cases where there are
+         pending bytes accumulating for a multibyte character
+       - _rl_insert_char: if the COUNT argument is 0, insert any pending
+         bytes read so far. The idea is that these bytes were accumulating
+         to compose a possible multibyte character, and the count of 0
+         indicates that the current character doesn't contribute to that
+         because it's bound to an editing command.
+       - rl_insert, rl_quoted_insert: make sure to call _rl_insert_char
+         with a 0 count as appropriate to insert any accumulating bytes
+         From a patch by Grisha Levit <grishalevit@gmail.com>
+
+sig.c
+       - top_level_cleanup,throw_to_top_level: set variable_context to 0, just
+         to make sure
+
+execute_cmd.c
+       - function_misc_cleanup: new function, runs make_funcname_visible and
+         unlink_fifo_list at the end of execute_function, replaces inline
+         code
+       - uw_function_misc_cleanup: unwind-protect function, just calls
+         function_misc_cleanup. Installed by execute_function.
+         Partial fix for FUNCNAME bug reported by Grisha Levit <grishalevit@gmail.com>
+       - execute_builtin: run unwind-protects if evalnest exeeds max
+       - execute_builtin: run unwind-protects if sourcenest exeeds max
+
+parse.y
+       - parse_string_to_word_list: set current_token = '\n' on error
+       - parse_string_to_word_list: if we're executing and not running in
+         parse_and_execute, call top_level_cleanup before we jump to the
+         top level. Rest of fix for FUNCNAME bug
+       - parse_compound_assignment: set last_read_token and current_token to
+         '\n' on parse error. Fix for alias expansion bug reported by
+         Grisha Levit <grishalevit@gmail.com>
+       - parse_compound_assignment: if we're executing and not running in
+         parse_and_execute, call top_level_cleanup before we jump to the
+         top level
+
+                                   5/2
+                                   ---
+jobs.c
+       - run_sigchld_trap: don't freeze and unfreeze the jobs list; move it
+         to the callers who are running this on SIGCHLD receipt and cannot
+         deal with jobs disappearing from the list while they're running
+       - waitchld: if we are running the wait builtin, continue to run the
+         SIGCHLD trap immediately upon signal receipt, but freeze and
+         unfreeze the jobs list around the call to run_sigchld_trap().
+         Fixes issue with `jobs' in a SIGCHLD trap not removing jobs from
+         the jobs list reported by Guldrelokk <me@rarity.fan>
+
+                                   5/4
+                                   ---
+input.c
+       - fd_to_buffered_stream: make sure buffers[fd2] is non-null before
+         turning on SHAREDBUF.
+         From Emanuele Torre <torreemanuele6@gmail.com>
+
+eval.c
+       - reader_loop: save and restore EOF_Reached around expanding $PS0,
+         setting it to 0 for the expansion so it doesn't affect things like
+         command substitution.
          From a report by Grisha Levit <grishalevit@gmail.com>
index b5807c8f56ed8f8f750c9a216cbcf14b52f775fa..9e121fcd053c2e951c0216ed890a66ef26d4f447 100644 (file)
@@ -1205,9 +1205,11 @@ P\bPA\bAR\bRA\bAM\bME\bET\bTE\bER\bRS\bS
               _\bm_\bt_\bi_\bm_\be, _\ba_\bt_\bi_\bm_\be, _\bc_\bt_\bi_\bm_\be, and _\bb_\bl_\bo_\bc_\bk_\bs, which sort the files  on  name,
               file  size,  modification  time, access time, inode change time,
               and number of blocks, respectively.  For  example,  a  value  of
-              -\b-m\bmt\bti\bim\bme\be  sorts  the  results  in descending order by modification
-              time (newest first).  If the sort specifier is missing,  it  de-
-              faults  to  _\bn_\ba_\bm_\be,  so  a  value  of  _\b+ is equivalent to the null
+              _\b-_\bm_\bt_\bi_\bm_\be  sorts  the  results  in descending order by modification
+              time (newest first).  A sort specifier of _\bn_\bo_\bs_\bo_\br_\bt disables  sort-
+              ing  completely;  the results are returned in the order they are
+              read from the file system,.  If the sort specifier  is  missing,
+              it  defaults  to _\bn_\ba_\bm_\be, so a value of _\b+ is equivalent to the null
               string, and a value of _\b- sorts by name in descending order.  Any
               invalid value restores the historical sorting behavior.
        H\bHI\bIS\bST\bTC\bCO\bON\bNT\bTR\bRO\bOL\bL
index 0893ebbb21b387b28f6d86bc8a18f85dbc8fca06..67fb0cb61cd524a6b48e5ca297ae2d0a73382389 100644 (file)
@@ -5581,6 +5581,10 @@ Variables::).
      For example, a value of '-mtime' sorts the results in descending
      order by modification time (newest first).
 
+     A sort specifier of 'nosort' disables sorting completely; the
+     results are returned in the order they are read from the file
+     system,.
+
      If the sort specifier is missing, it defaults to NAME, so a value
      of '+' is equivalent to the null string, and a value of '-' sorts
      by name in descending order.
@@ -12194,57 +12198,57 @@ D.3 Parameter and Variable Index
 * FUNCNEST:                              Bash Variables.      (line 343)
 * GLOBIGNORE:                            Bash Variables.      (line 348)
 * GLOBSORT:                              Bash Variables.      (line 355)
-* GROUPS:                                Bash Variables.      (line 377)
-* histchars:                             Bash Variables.      (line 383)
-* HISTCMD:                               Bash Variables.      (line 398)
-* HISTCONTROL:                           Bash Variables.      (line 404)
-* HISTFILE:                              Bash Variables.      (line 420)
-* HISTFILESIZE:                          Bash Variables.      (line 424)
-* HISTIGNORE:                            Bash Variables.      (line 435)
+* GROUPS:                                Bash Variables.      (line 381)
+* histchars:                             Bash Variables.      (line 387)
+* HISTCMD:                               Bash Variables.      (line 402)
+* HISTCONTROL:                           Bash Variables.      (line 408)
+* HISTFILE:                              Bash Variables.      (line 424)
+* HISTFILESIZE:                          Bash Variables.      (line 428)
+* HISTIGNORE:                            Bash Variables.      (line 439)
 * history-preserve-point:                Readline Init File Syntax.
                                                               (line 211)
 * history-size:                          Readline Init File Syntax.
                                                               (line 217)
-* HISTSIZE:                              Bash Variables.      (line 455)
-* HISTTIMEFORMAT:                        Bash Variables.      (line 462)
+* HISTSIZE:                              Bash Variables.      (line 459)
+* HISTTIMEFORMAT:                        Bash Variables.      (line 466)
 * HOME:                                  Bourne Shell Variables.
                                                               (line  13)
 * horizontal-scroll-mode:                Readline Init File Syntax.
                                                               (line 226)
-* HOSTFILE:                              Bash Variables.      (line 470)
-* HOSTNAME:                              Bash Variables.      (line 481)
-* HOSTTYPE:                              Bash Variables.      (line 484)
+* HOSTFILE:                              Bash Variables.      (line 474)
+* HOSTNAME:                              Bash Variables.      (line 485)
+* HOSTTYPE:                              Bash Variables.      (line 488)
 * IFS:                                   Bourne Shell Variables.
                                                               (line  18)
-* IGNOREEOF:                             Bash Variables.      (line 487)
+* IGNOREEOF:                             Bash Variables.      (line 491)
 * input-meta:                            Readline Init File Syntax.
                                                               (line 235)
-* INPUTRC:                               Bash Variables.      (line 497)
-* INSIDE_EMACS:                          Bash Variables.      (line 501)
+* INPUTRC:                               Bash Variables.      (line 501)
+* INSIDE_EMACS:                          Bash Variables.      (line 505)
 * isearch-terminators:                   Readline Init File Syntax.
                                                               (line 245)
 * keymap:                                Readline Init File Syntax.
                                                               (line 252)
 * LANG:                                  Creating Internationalized Scripts.
                                                               (line  51)
-* LANG <1>:                              Bash Variables.      (line 507)
-* LC_ALL:                                Bash Variables.      (line 511)
-* LC_COLLATE:                            Bash Variables.      (line 515)
-* LC_CTYPE:                              Bash Variables.      (line 522)
+* LANG <1>:                              Bash Variables.      (line 511)
+* LC_ALL:                                Bash Variables.      (line 515)
+* LC_COLLATE:                            Bash Variables.      (line 519)
+* LC_CTYPE:                              Bash Variables.      (line 526)
 * LC_MESSAGES:                           Creating Internationalized Scripts.
                                                               (line  51)
-* LC_MESSAGES <1>:                       Bash Variables.      (line 527)
-* LC_NUMERIC:                            Bash Variables.      (line 531)
-* LC_TIME:                               Bash Variables.      (line 535)
-* LINENO:                                Bash Variables.      (line 539)
-* LINES:                                 Bash Variables.      (line 544)
-* MACHTYPE:                              Bash Variables.      (line 550)
+* LC_MESSAGES <1>:                       Bash Variables.      (line 531)
+* LC_NUMERIC:                            Bash Variables.      (line 535)
+* LC_TIME:                               Bash Variables.      (line 539)
+* LINENO:                                Bash Variables.      (line 543)
+* LINES:                                 Bash Variables.      (line 548)
+* MACHTYPE:                              Bash Variables.      (line 554)
 * MAIL:                                  Bourne Shell Variables.
                                                               (line  22)
-* MAILCHECK:                             Bash Variables.      (line 554)
+* MAILCHECK:                             Bash Variables.      (line 558)
 * MAILPATH:                              Bourne Shell Variables.
                                                               (line  27)
-* MAPFILE:                               Bash Variables.      (line 562)
+* MAPFILE:                               Bash Variables.      (line 566)
 * mark-modified-lines:                   Readline Init File Syntax.
                                                               (line 282)
 * mark-symlinked-directories:            Readline Init File Syntax.
@@ -12255,46 +12259,46 @@ D.3 Parameter and Variable Index
                                                               (line 299)
 * meta-flag:                             Readline Init File Syntax.
                                                               (line 235)
-* OLDPWD:                                Bash Variables.      (line 566)
+* OLDPWD:                                Bash Variables.      (line 570)
 * OPTARG:                                Bourne Shell Variables.
                                                               (line  34)
-* OPTERR:                                Bash Variables.      (line 569)
+* OPTERR:                                Bash Variables.      (line 573)
 * OPTIND:                                Bourne Shell Variables.
                                                               (line  38)
-* OSTYPE:                                Bash Variables.      (line 573)
+* OSTYPE:                                Bash Variables.      (line 577)
 * output-meta:                           Readline Init File Syntax.
                                                               (line 304)
 * page-completions:                      Readline Init File Syntax.
                                                               (line 312)
 * PATH:                                  Bourne Shell Variables.
                                                               (line  42)
-* PIPESTATUS:                            Bash Variables.      (line 576)
-* POSIXLY_CORRECT:                       Bash Variables.      (line 581)
-* PPID:                                  Bash Variables.      (line 591)
-* PROMPT_COMMAND:                        Bash Variables.      (line 595)
-* PROMPT_DIRTRIM:                        Bash Variables.      (line 601)
-* PS0:                                   Bash Variables.      (line 607)
+* PIPESTATUS:                            Bash Variables.      (line 580)
+* POSIXLY_CORRECT:                       Bash Variables.      (line 585)
+* PPID:                                  Bash Variables.      (line 595)
+* PROMPT_COMMAND:                        Bash Variables.      (line 599)
+* PROMPT_DIRTRIM:                        Bash Variables.      (line 605)
+* PS0:                                   Bash Variables.      (line 611)
 * PS1:                                   Bourne Shell Variables.
                                                               (line  48)
 * PS2:                                   Bourne Shell Variables.
                                                               (line  53)
-* PS3:                                   Bash Variables.      (line 612)
-* PS4:                                   Bash Variables.      (line 617)
-* PWD:                                   Bash Variables.      (line 625)
-* RANDOM:                                Bash Variables.      (line 628)
-* READLINE_ARGUMENT:                     Bash Variables.      (line 634)
-* READLINE_LINE:                         Bash Variables.      (line 638)
-* READLINE_MARK:                         Bash Variables.      (line 642)
-* READLINE_POINT:                        Bash Variables.      (line 648)
-* REPLY:                                 Bash Variables.      (line 652)
+* PS3:                                   Bash Variables.      (line 616)
+* PS4:                                   Bash Variables.      (line 621)
+* PWD:                                   Bash Variables.      (line 629)
+* RANDOM:                                Bash Variables.      (line 632)
+* READLINE_ARGUMENT:                     Bash Variables.      (line 638)
+* READLINE_LINE:                         Bash Variables.      (line 642)
+* READLINE_MARK:                         Bash Variables.      (line 646)
+* READLINE_POINT:                        Bash Variables.      (line 652)
+* REPLY:                                 Bash Variables.      (line 656)
 * revert-all-at-newline:                 Readline Init File Syntax.
                                                               (line 322)
 * search-ignore-case:                    Readline Init File Syntax.
                                                               (line 329)
-* SECONDS:                               Bash Variables.      (line 655)
-* SHELL:                                 Bash Variables.      (line 664)
-* SHELLOPTS:                             Bash Variables.      (line 669)
-* SHLVL:                                 Bash Variables.      (line 678)
+* SECONDS:                               Bash Variables.      (line 659)
+* SHELL:                                 Bash Variables.      (line 668)
+* SHELLOPTS:                             Bash Variables.      (line 673)
+* SHLVL:                                 Bash Variables.      (line 682)
 * show-all-if-ambiguous:                 Readline Init File Syntax.
                                                               (line 334)
 * show-all-if-unmodified:                Readline Init File Syntax.
@@ -12303,15 +12307,15 @@ D.3 Parameter and Variable Index
                                                               (line 349)
 * skip-completed-text:                   Readline Init File Syntax.
                                                               (line 355)
-* SRANDOM:                               Bash Variables.      (line 683)
+* SRANDOM:                               Bash Variables.      (line 687)
 * TEXTDOMAIN:                            Creating Internationalized Scripts.
                                                               (line  51)
 * TEXTDOMAINDIR:                         Creating Internationalized Scripts.
                                                               (line  51)
-* TIMEFORMAT:                            Bash Variables.      (line 692)
-* TMOUT:                                 Bash Variables.      (line 730)
-* TMPDIR:                                Bash Variables.      (line 742)
-* UID:                                   Bash Variables.      (line 746)
+* TIMEFORMAT:                            Bash Variables.      (line 696)
+* TMOUT:                                 Bash Variables.      (line 734)
+* TMPDIR:                                Bash Variables.      (line 746)
+* UID:                                   Bash Variables.      (line 750)
 * vi-cmd-mode-string:                    Readline Init File Syntax.
                                                               (line 368)
 * vi-ins-mode-string:                    Readline Init File Syntax.
@@ -12763,77 +12767,77 @@ Node: Special Builtins\7f220857
 Node: Shell Variables\7f221833
 Node: Bourne Shell Variables\7f222267
 Node: Bash Variables\7f224368
-Node: Bash Features\7f258281
-Node: Invoking Bash\7f259291
-Node: Bash Startup Files\7f265301
-Node: Interactive Shells\7f270429
-Node: What is an Interactive Shell?\7f270837
-Node: Is this Shell Interactive?\7f271483
-Node: Interactive Shell Behavior\7f272295
-Node: Bash Conditional Expressions\7f275921
-Node: Shell Arithmetic\7f280560
-Node: Aliases\7f283518
-Node: Arrays\7f286409
-Node: The Directory Stack\7f292969
-Node: Directory Stack Builtins\7f293750
-Node: Controlling the Prompt\7f298007
-Node: The Restricted Shell\7f300969
-Node: Bash POSIX Mode\7f303576
-Node: Shell Compatibility Mode\7f319366
-Node: Job Control\7f327607
-Node: Job Control Basics\7f328064
-Node: Job Control Builtins\7f333063
-Node: Job Control Variables\7f338855
-Node: Command Line Editing\7f340008
-Node: Introduction and Notation\7f341676
-Node: Readline Interaction\7f343296
-Node: Readline Bare Essentials\7f344484
-Node: Readline Movement Commands\7f346270
-Node: Readline Killing Commands\7f347227
-Node: Readline Arguments\7f349145
-Node: Searching\7f350186
-Node: Readline Init File\7f352369
-Node: Readline Init File Syntax\7f353627
-Node: Conditional Init Constructs\7f377415
-Node: Sample Init File\7f381608
-Node: Bindable Readline Commands\7f384729
-Node: Commands For Moving\7f385930
-Node: Commands For History\7f387978
-Node: Commands For Text\7f392969
-Node: Commands For Killing\7f396615
-Node: Numeric Arguments\7f399645
-Node: Commands For Completion\7f400781
-Node: Keyboard Macros\7f404969
-Node: Miscellaneous Commands\7f405654
-Node: Readline vi Mode\7f411689
-Node: Programmable Completion\7f412593
-Node: Programmable Completion Builtins\7f420370
-Node: A Programmable Completion Example\7f431355
-Node: Using History Interactively\7f436600
-Node: Bash History Facilities\7f437281
-Node: Bash History Builtins\7f440283
-Node: History Interaction\7f445304
-Node: Event Designators\7f448921
-Node: Word Designators\7f450272
-Node: Modifiers\7f452029
-Node: Installing Bash\7f453834
-Node: Basic Installation\7f454968
-Node: Compilers and Options\7f458687
-Node: Compiling For Multiple Architectures\7f459425
-Node: Installation Names\7f461114
-Node: Specifying the System Type\7f463220
-Node: Sharing Defaults\7f463934
-Node: Operation Controls\7f464604
-Node: Optional Features\7f465559
-Node: Reporting Bugs\7f476775
-Node: Major Differences From The Bourne Shell\7f478106
-Node: GNU Free Documentation License\7f494952
-Node: Indexes\7f520126
-Node: Builtin Index\7f520577
-Node: Reserved Word Index\7f527401
-Node: Variable Index\7f529846
-Node: Function Index\7f546831
-Node: Concept Index\7f560612
+Node: Bash Features\7f258430
+Node: Invoking Bash\7f259440
+Node: Bash Startup Files\7f265450
+Node: Interactive Shells\7f270578
+Node: What is an Interactive Shell?\7f270986
+Node: Is this Shell Interactive?\7f271632
+Node: Interactive Shell Behavior\7f272444
+Node: Bash Conditional Expressions\7f276070
+Node: Shell Arithmetic\7f280709
+Node: Aliases\7f283667
+Node: Arrays\7f286558
+Node: The Directory Stack\7f293118
+Node: Directory Stack Builtins\7f293899
+Node: Controlling the Prompt\7f298156
+Node: The Restricted Shell\7f301118
+Node: Bash POSIX Mode\7f303725
+Node: Shell Compatibility Mode\7f319515
+Node: Job Control\7f327756
+Node: Job Control Basics\7f328213
+Node: Job Control Builtins\7f333212
+Node: Job Control Variables\7f339004
+Node: Command Line Editing\7f340157
+Node: Introduction and Notation\7f341825
+Node: Readline Interaction\7f343445
+Node: Readline Bare Essentials\7f344633
+Node: Readline Movement Commands\7f346419
+Node: Readline Killing Commands\7f347376
+Node: Readline Arguments\7f349294
+Node: Searching\7f350335
+Node: Readline Init File\7f352518
+Node: Readline Init File Syntax\7f353776
+Node: Conditional Init Constructs\7f377564
+Node: Sample Init File\7f381757
+Node: Bindable Readline Commands\7f384878
+Node: Commands For Moving\7f386079
+Node: Commands For History\7f388127
+Node: Commands For Text\7f393118
+Node: Commands For Killing\7f396764
+Node: Numeric Arguments\7f399794
+Node: Commands For Completion\7f400930
+Node: Keyboard Macros\7f405118
+Node: Miscellaneous Commands\7f405803
+Node: Readline vi Mode\7f411838
+Node: Programmable Completion\7f412742
+Node: Programmable Completion Builtins\7f420519
+Node: A Programmable Completion Example\7f431504
+Node: Using History Interactively\7f436749
+Node: Bash History Facilities\7f437430
+Node: Bash History Builtins\7f440432
+Node: History Interaction\7f445453
+Node: Event Designators\7f449070
+Node: Word Designators\7f450421
+Node: Modifiers\7f452178
+Node: Installing Bash\7f453983
+Node: Basic Installation\7f455117
+Node: Compilers and Options\7f458836
+Node: Compiling For Multiple Architectures\7f459574
+Node: Installation Names\7f461263
+Node: Specifying the System Type\7f463369
+Node: Sharing Defaults\7f464083
+Node: Operation Controls\7f464753
+Node: Optional Features\7f465708
+Node: Reporting Bugs\7f476924
+Node: Major Differences From The Bourne Shell\7f478255
+Node: GNU Free Documentation License\7f495101
+Node: Indexes\7f520275
+Node: Builtin Index\7f520726
+Node: Reserved Word Index\7f527550
+Node: Variable Index\7f529995
+Node: Function Index\7f546980
+Node: Concept Index\7f560761
 \1f
 End Tag Table
 
index eb05765fe17813d1c06df6c43a5b82d3ab8e755f..fe2b2481115ee5d9bf2c24b797af6ba671566c85 100644 (file)
@@ -5582,6 +5582,10 @@ Variables::).
      For example, a value of '-mtime' sorts the results in descending
      order by modification time (newest first).
 
+     A sort specifier of 'nosort' disables sorting completely; the
+     results are returned in the order they are read from the file
+     system,.
+
      If the sort specifier is missing, it defaults to NAME, so a value
      of '+' is equivalent to the null string, and a value of '-' sorts
      by name in descending order.
@@ -12195,57 +12199,57 @@ D.3 Parameter and Variable Index
 * FUNCNEST:                              Bash Variables.      (line 343)
 * GLOBIGNORE:                            Bash Variables.      (line 348)
 * GLOBSORT:                              Bash Variables.      (line 355)
-* GROUPS:                                Bash Variables.      (line 377)
-* histchars:                             Bash Variables.      (line 383)
-* HISTCMD:                               Bash Variables.      (line 398)
-* HISTCONTROL:                           Bash Variables.      (line 404)
-* HISTFILE:                              Bash Variables.      (line 420)
-* HISTFILESIZE:                          Bash Variables.      (line 424)
-* HISTIGNORE:                            Bash Variables.      (line 435)
+* GROUPS:                                Bash Variables.      (line 381)
+* histchars:                             Bash Variables.      (line 387)
+* HISTCMD:                               Bash Variables.      (line 402)
+* HISTCONTROL:                           Bash Variables.      (line 408)
+* HISTFILE:                              Bash Variables.      (line 424)
+* HISTFILESIZE:                          Bash Variables.      (line 428)
+* HISTIGNORE:                            Bash Variables.      (line 439)
 * history-preserve-point:                Readline Init File Syntax.
                                                               (line 211)
 * history-size:                          Readline Init File Syntax.
                                                               (line 217)
-* HISTSIZE:                              Bash Variables.      (line 455)
-* HISTTIMEFORMAT:                        Bash Variables.      (line 462)
+* HISTSIZE:                              Bash Variables.      (line 459)
+* HISTTIMEFORMAT:                        Bash Variables.      (line 466)
 * HOME:                                  Bourne Shell Variables.
                                                               (line  13)
 * horizontal-scroll-mode:                Readline Init File Syntax.
                                                               (line 226)
-* HOSTFILE:                              Bash Variables.      (line 470)
-* HOSTNAME:                              Bash Variables.      (line 481)
-* HOSTTYPE:                              Bash Variables.      (line 484)
+* HOSTFILE:                              Bash Variables.      (line 474)
+* HOSTNAME:                              Bash Variables.      (line 485)
+* HOSTTYPE:                              Bash Variables.      (line 488)
 * IFS:                                   Bourne Shell Variables.
                                                               (line  18)
-* IGNOREEOF:                             Bash Variables.      (line 487)
+* IGNOREEOF:                             Bash Variables.      (line 491)
 * input-meta:                            Readline Init File Syntax.
                                                               (line 235)
-* INPUTRC:                               Bash Variables.      (line 497)
-* INSIDE_EMACS:                          Bash Variables.      (line 501)
+* INPUTRC:                               Bash Variables.      (line 501)
+* INSIDE_EMACS:                          Bash Variables.      (line 505)
 * isearch-terminators:                   Readline Init File Syntax.
                                                               (line 245)
 * keymap:                                Readline Init File Syntax.
                                                               (line 252)
 * LANG:                                  Creating Internationalized Scripts.
                                                               (line  51)
-* LANG <1>:                              Bash Variables.      (line 507)
-* LC_ALL:                                Bash Variables.      (line 511)
-* LC_COLLATE:                            Bash Variables.      (line 515)
-* LC_CTYPE:                              Bash Variables.      (line 522)
+* LANG <1>:                              Bash Variables.      (line 511)
+* LC_ALL:                                Bash Variables.      (line 515)
+* LC_COLLATE:                            Bash Variables.      (line 519)
+* LC_CTYPE:                              Bash Variables.      (line 526)
 * LC_MESSAGES:                           Creating Internationalized Scripts.
                                                               (line  51)
-* LC_MESSAGES <1>:                       Bash Variables.      (line 527)
-* LC_NUMERIC:                            Bash Variables.      (line 531)
-* LC_TIME:                               Bash Variables.      (line 535)
-* LINENO:                                Bash Variables.      (line 539)
-* LINES:                                 Bash Variables.      (line 544)
-* MACHTYPE:                              Bash Variables.      (line 550)
+* LC_MESSAGES <1>:                       Bash Variables.      (line 531)
+* LC_NUMERIC:                            Bash Variables.      (line 535)
+* LC_TIME:                               Bash Variables.      (line 539)
+* LINENO:                                Bash Variables.      (line 543)
+* LINES:                                 Bash Variables.      (line 548)
+* MACHTYPE:                              Bash Variables.      (line 554)
 * MAIL:                                  Bourne Shell Variables.
                                                               (line  22)
-* MAILCHECK:                             Bash Variables.      (line 554)
+* MAILCHECK:                             Bash Variables.      (line 558)
 * MAILPATH:                              Bourne Shell Variables.
                                                               (line  27)
-* MAPFILE:                               Bash Variables.      (line 562)
+* MAPFILE:                               Bash Variables.      (line 566)
 * mark-modified-lines:                   Readline Init File Syntax.
                                                               (line 282)
 * mark-symlinked-directories:            Readline Init File Syntax.
@@ -12256,46 +12260,46 @@ D.3 Parameter and Variable Index
                                                               (line 299)
 * meta-flag:                             Readline Init File Syntax.
                                                               (line 235)
-* OLDPWD:                                Bash Variables.      (line 566)
+* OLDPWD:                                Bash Variables.      (line 570)
 * OPTARG:                                Bourne Shell Variables.
                                                               (line  34)
-* OPTERR:                                Bash Variables.      (line 569)
+* OPTERR:                                Bash Variables.      (line 573)
 * OPTIND:                                Bourne Shell Variables.
                                                               (line  38)
-* OSTYPE:                                Bash Variables.      (line 573)
+* OSTYPE:                                Bash Variables.      (line 577)
 * output-meta:                           Readline Init File Syntax.
                                                               (line 304)
 * page-completions:                      Readline Init File Syntax.
                                                               (line 312)
 * PATH:                                  Bourne Shell Variables.
                                                               (line  42)
-* PIPESTATUS:                            Bash Variables.      (line 576)
-* POSIXLY_CORRECT:                       Bash Variables.      (line 581)
-* PPID:                                  Bash Variables.      (line 591)
-* PROMPT_COMMAND:                        Bash Variables.      (line 595)
-* PROMPT_DIRTRIM:                        Bash Variables.      (line 601)
-* PS0:                                   Bash Variables.      (line 607)
+* PIPESTATUS:                            Bash Variables.      (line 580)
+* POSIXLY_CORRECT:                       Bash Variables.      (line 585)
+* PPID:                                  Bash Variables.      (line 595)
+* PROMPT_COMMAND:                        Bash Variables.      (line 599)
+* PROMPT_DIRTRIM:                        Bash Variables.      (line 605)
+* PS0:                                   Bash Variables.      (line 611)
 * PS1:                                   Bourne Shell Variables.
                                                               (line  48)
 * PS2:                                   Bourne Shell Variables.
                                                               (line  53)
-* PS3:                                   Bash Variables.      (line 612)
-* PS4:                                   Bash Variables.      (line 617)
-* PWD:                                   Bash Variables.      (line 625)
-* RANDOM:                                Bash Variables.      (line 628)
-* READLINE_ARGUMENT:                     Bash Variables.      (line 634)
-* READLINE_LINE:                         Bash Variables.      (line 638)
-* READLINE_MARK:                         Bash Variables.      (line 642)
-* READLINE_POINT:                        Bash Variables.      (line 648)
-* REPLY:                                 Bash Variables.      (line 652)
+* PS3:                                   Bash Variables.      (line 616)
+* PS4:                                   Bash Variables.      (line 621)
+* PWD:                                   Bash Variables.      (line 629)
+* RANDOM:                                Bash Variables.      (line 632)
+* READLINE_ARGUMENT:                     Bash Variables.      (line 638)
+* READLINE_LINE:                         Bash Variables.      (line 642)
+* READLINE_MARK:                         Bash Variables.      (line 646)
+* READLINE_POINT:                        Bash Variables.      (line 652)
+* REPLY:                                 Bash Variables.      (line 656)
 * revert-all-at-newline:                 Readline Init File Syntax.
                                                               (line 322)
 * search-ignore-case:                    Readline Init File Syntax.
                                                               (line 329)
-* SECONDS:                               Bash Variables.      (line 655)
-* SHELL:                                 Bash Variables.      (line 664)
-* SHELLOPTS:                             Bash Variables.      (line 669)
-* SHLVL:                                 Bash Variables.      (line 678)
+* SECONDS:                               Bash Variables.      (line 659)
+* SHELL:                                 Bash Variables.      (line 668)
+* SHELLOPTS:                             Bash Variables.      (line 673)
+* SHLVL:                                 Bash Variables.      (line 682)
 * show-all-if-ambiguous:                 Readline Init File Syntax.
                                                               (line 334)
 * show-all-if-unmodified:                Readline Init File Syntax.
@@ -12304,15 +12308,15 @@ D.3 Parameter and Variable Index
                                                               (line 349)
 * skip-completed-text:                   Readline Init File Syntax.
                                                               (line 355)
-* SRANDOM:                               Bash Variables.      (line 683)
+* SRANDOM:                               Bash Variables.      (line 687)
 * TEXTDOMAIN:                            Creating Internationalized Scripts.
                                                               (line  51)
 * TEXTDOMAINDIR:                         Creating Internationalized Scripts.
                                                               (line  51)
-* TIMEFORMAT:                            Bash Variables.      (line 692)
-* TMOUT:                                 Bash Variables.      (line 730)
-* TMPDIR:                                Bash Variables.      (line 742)
-* UID:                                   Bash Variables.      (line 746)
+* TIMEFORMAT:                            Bash Variables.      (line 696)
+* TMOUT:                                 Bash Variables.      (line 734)
+* TMPDIR:                                Bash Variables.      (line 746)
+* UID:                                   Bash Variables.      (line 750)
 * vi-cmd-mode-string:                    Readline Init File Syntax.
                                                               (line 368)
 * vi-ins-mode-string:                    Readline Init File Syntax.
@@ -12764,77 +12768,77 @@ Node: Special Builtins\7f221031
 Node: Shell Variables\7f222010
 Node: Bourne Shell Variables\7f222447
 Node: Bash Variables\7f224551
-Node: Bash Features\7f258467
-Node: Invoking Bash\7f259480
-Node: Bash Startup Files\7f265493
-Node: Interactive Shells\7f270624
-Node: What is an Interactive Shell?\7f271035
-Node: Is this Shell Interactive?\7f271684
-Node: Interactive Shell Behavior\7f272499
-Node: Bash Conditional Expressions\7f276128
-Node: Shell Arithmetic\7f280770
-Node: Aliases\7f283731
-Node: Arrays\7f286625
-Node: The Directory Stack\7f293188
-Node: Directory Stack Builtins\7f293972
-Node: Controlling the Prompt\7f298232
-Node: The Restricted Shell\7f301197
-Node: Bash POSIX Mode\7f303807
-Node: Shell Compatibility Mode\7f319600
-Node: Job Control\7f327844
-Node: Job Control Basics\7f328304
-Node: Job Control Builtins\7f333306
-Node: Job Control Variables\7f339101
-Node: Command Line Editing\7f340257
-Node: Introduction and Notation\7f341928
-Node: Readline Interaction\7f343551
-Node: Readline Bare Essentials\7f344742
-Node: Readline Movement Commands\7f346531
-Node: Readline Killing Commands\7f347491
-Node: Readline Arguments\7f349412
-Node: Searching\7f350456
-Node: Readline Init File\7f352642
-Node: Readline Init File Syntax\7f353903
-Node: Conditional Init Constructs\7f377694
-Node: Sample Init File\7f381890
-Node: Bindable Readline Commands\7f385014
-Node: Commands For Moving\7f386218
-Node: Commands For History\7f388269
-Node: Commands For Text\7f393263
-Node: Commands For Killing\7f396912
-Node: Numeric Arguments\7f399945
-Node: Commands For Completion\7f401084
-Node: Keyboard Macros\7f405275
-Node: Miscellaneous Commands\7f405963
-Node: Readline vi Mode\7f412001
-Node: Programmable Completion\7f412908
-Node: Programmable Completion Builtins\7f420688
-Node: A Programmable Completion Example\7f431676
-Node: Using History Interactively\7f436924
-Node: Bash History Facilities\7f437608
-Node: Bash History Builtins\7f440613
-Node: History Interaction\7f445637
-Node: Event Designators\7f449257
-Node: Word Designators\7f450611
-Node: Modifiers\7f452371
-Node: Installing Bash\7f454179
-Node: Basic Installation\7f455316
-Node: Compilers and Options\7f459038
-Node: Compiling For Multiple Architectures\7f459779
-Node: Installation Names\7f461471
-Node: Specifying the System Type\7f463580
-Node: Sharing Defaults\7f464297
-Node: Operation Controls\7f464970
-Node: Optional Features\7f465928
-Node: Reporting Bugs\7f477147
-Node: Major Differences From The Bourne Shell\7f478481
-Node: GNU Free Documentation License\7f495330
-Node: Indexes\7f520507
-Node: Builtin Index\7f520961
-Node: Reserved Word Index\7f527788
-Node: Variable Index\7f530236
-Node: Function Index\7f547224
-Node: Concept Index\7f561008
+Node: Bash Features\7f258616
+Node: Invoking Bash\7f259629
+Node: Bash Startup Files\7f265642
+Node: Interactive Shells\7f270773
+Node: What is an Interactive Shell?\7f271184
+Node: Is this Shell Interactive?\7f271833
+Node: Interactive Shell Behavior\7f272648
+Node: Bash Conditional Expressions\7f276277
+Node: Shell Arithmetic\7f280919
+Node: Aliases\7f283880
+Node: Arrays\7f286774
+Node: The Directory Stack\7f293337
+Node: Directory Stack Builtins\7f294121
+Node: Controlling the Prompt\7f298381
+Node: The Restricted Shell\7f301346
+Node: Bash POSIX Mode\7f303956
+Node: Shell Compatibility Mode\7f319749
+Node: Job Control\7f327993
+Node: Job Control Basics\7f328453
+Node: Job Control Builtins\7f333455
+Node: Job Control Variables\7f339250
+Node: Command Line Editing\7f340406
+Node: Introduction and Notation\7f342077
+Node: Readline Interaction\7f343700
+Node: Readline Bare Essentials\7f344891
+Node: Readline Movement Commands\7f346680
+Node: Readline Killing Commands\7f347640
+Node: Readline Arguments\7f349561
+Node: Searching\7f350605
+Node: Readline Init File\7f352791
+Node: Readline Init File Syntax\7f354052
+Node: Conditional Init Constructs\7f377843
+Node: Sample Init File\7f382039
+Node: Bindable Readline Commands\7f385163
+Node: Commands For Moving\7f386367
+Node: Commands For History\7f388418
+Node: Commands For Text\7f393412
+Node: Commands For Killing\7f397061
+Node: Numeric Arguments\7f400094
+Node: Commands For Completion\7f401233
+Node: Keyboard Macros\7f405424
+Node: Miscellaneous Commands\7f406112
+Node: Readline vi Mode\7f412150
+Node: Programmable Completion\7f413057
+Node: Programmable Completion Builtins\7f420837
+Node: A Programmable Completion Example\7f431825
+Node: Using History Interactively\7f437073
+Node: Bash History Facilities\7f437757
+Node: Bash History Builtins\7f440762
+Node: History Interaction\7f445786
+Node: Event Designators\7f449406
+Node: Word Designators\7f450760
+Node: Modifiers\7f452520
+Node: Installing Bash\7f454328
+Node: Basic Installation\7f455465
+Node: Compilers and Options\7f459187
+Node: Compiling For Multiple Architectures\7f459928
+Node: Installation Names\7f461620
+Node: Specifying the System Type\7f463729
+Node: Sharing Defaults\7f464446
+Node: Operation Controls\7f465119
+Node: Optional Features\7f466077
+Node: Reporting Bugs\7f477296
+Node: Major Differences From The Bourne Shell\7f478630
+Node: GNU Free Documentation License\7f495479
+Node: Indexes\7f520656
+Node: Builtin Index\7f521110
+Node: Reserved Word Index\7f527937
+Node: Variable Index\7f530385
+Node: Function Index\7f547373
+Node: Concept Index\7f561157
 \1f
 End Tag Table
 
diff --git a/eval.c b/eval.c
index 7d6bdb360d3712dee4d60ccf2d727d088249c6f6..b54ba52c393f486335a0d2b60bafcf9821f3806f 100644 (file)
--- a/eval.c
+++ b/eval.c
@@ -153,7 +153,10 @@ reader_loop (void)
              if (interactive && ps0_prompt)
                {
                  char *ps0_string;
+                 int old_eof;
 
+                 old_eof = EOF_Reached;
+                 EOF_Reached = 0;
                  ps0_string = decode_prompt_string (ps0_prompt);
                  if (ps0_string && *ps0_string)
                    {
@@ -161,6 +164,7 @@ reader_loop (void)
                      fflush (stderr);
                    }
                  free (ps0_string);
+                 EOF_Reached = old_eof;
                }
 
              current_command_number++;
index 210b976c353b1bfd7b16f973cd1039d4935dfabb..77cecb31727b03add2b6eb8cf3f7a79073634358 100644 (file)
@@ -4893,8 +4893,9 @@ execute_builtin (sh_builtin_func_t *builtin, WORD_LIST *words, int flags, int su
       if (evalnest_max > 0 && evalnest >= evalnest_max)
        {
          internal_error (_("eval: maximum eval nesting level exceeded (%d)"), evalnest);
+         run_unwind_protects ();       /* XXX */
          evalnest = 0;
-         jump_to_top_level (DISCARD);
+         jump_to_top_level (DISCARD);  /* XXX - cleanup? */
        }
       unwind_protect_int (evalnest);
       /* The test for subshell == 0 above doesn't make a difference */
@@ -4905,8 +4906,9 @@ execute_builtin (sh_builtin_func_t *builtin, WORD_LIST *words, int flags, int su
       if (sourcenest_max > 0 && sourcenest >= sourcenest_max)
        {
          internal_error (_("%s: maximum source nesting level exceeded (%d)"), this_command_name, sourcenest);
+         run_unwind_protects ();       /* XXX */
          sourcenest = 0;
-         jump_to_top_level (DISCARD);
+         jump_to_top_level (DISCARD);  /* XXX - cleanup? */
        }
       unwind_protect_int (sourcenest);
       /* The test for subshell == 0 above doesn't make a difference */
@@ -4992,6 +4994,24 @@ uw_restore_funcarray_state (void *fa)
 }
 #endif
 
+static void
+function_misc_cleanup (void)
+{
+  if (variable_context == 0 || this_shell_function == 0)
+    {
+      make_funcname_visible (0);
+#if defined (PROCESS_SUBSTITUTION)
+      unlink_fifo_list ();
+#endif
+    }
+}
+
+static void
+uw_function_misc_cleanup (void *ignore)
+{
+  function_misc_cleanup ();
+}
+
 static int
 execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap *fds_to_close, int async, int subshell)
 {
@@ -5050,6 +5070,8 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
         local variables may cause the restore of a local declaration of
         OPTIND to force a getopts state reset. */
       add_unwind_protect (uw_maybe_restore_getopt_state, gs);
+      /* This also, because pop_context has to decrement variable_context */
+      add_unwind_protect (uw_function_misc_cleanup, NULL);      
       add_unwind_protect (pop_context, NULL);
       unwind_protect_int (line_number);
       unwind_protect_int (line_number_for_err_trap);
@@ -5235,14 +5257,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
     }
 #endif
 
-  if (variable_context == 0 || this_shell_function == 0)
-    {
-      make_funcname_visible (0);
-#if defined (PROCESS_SUBSTITUTION)
-      unlink_fifo_list ();
-#endif
-    }
-
+  function_misc_cleanup ();
   return (result);
 }
 
diff --git a/input.c b/input.c
index 6eab9909e9067527b489e5f5dd2d921e6e3866cd..ad1ebefdb1d375e117daa150468724edb1e78eb7 100644 (file)
--- a/input.c
+++ b/input.c
@@ -359,7 +359,7 @@ duplicate_buffered_stream (int fd1, int fd2)
       buffers[fd2]->b_flag |= B_WASBASHINPUT;
     }
 
-  if (fd_is_bash_input (fd1) || (buffers[fd1] && (buffers[fd1]->b_flag & B_SHAREDBUF)))
+  if (buffers[fd2] && (fd_is_bash_input (fd1) || (buffers[fd1] && (buffers[fd1]->b_flag & B_SHAREDBUF))))
     buffers[fd2]->b_flag |= B_SHAREDBUF;
 
   return (fd2);
diff --git a/jobs.c b/jobs.c
index a34fe2dda388c4fca4ad311108f197d112446e4a..8dc9a037c1a1ca32a03d161ce40fb1e4711df9c6 100644 (file)
--- a/jobs.c
+++ b/jobs.c
@@ -3900,7 +3900,13 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc
       else if (running_trap)
        queue_sigchld_trap (children_exited);
       else if (this_shell_builtin == wait_builtin)
-       run_sigchld_trap (children_exited);     /* XXX */
+       {
+         int o;
+         o = jobs_list_frozen;
+         jobs_list_frozen = 1;
+         run_sigchld_trap (children_exited);   /* XXX */
+         jobs_list_frozen = o;
+       }
       else
        queue_sigchld_trap (children_exited);
     }
@@ -4158,7 +4164,6 @@ run_sigchld_trap (int nchild)
   running_trap = SIGCHLD + 1;
 
   set_impossible_sigchld_trap ();
-  jobs_list_frozen = 1;
   for (i = 0; i < nchild; i++)
     {
       parse_and_execute (savestring (trap_command), "trap", SEVAL_NOHIST|SEVAL_RESETLINE|SEVAL_NOOPTIMIZE);
@@ -4869,10 +4874,14 @@ freeze_jobs_list (void)
   return o;
 }
 
-void
+int
 unfreeze_jobs_list (void)
 {
+  int o;
+
+  o = jobs_list_frozen;
   jobs_list_frozen = 0;
+  return 0;
 }
 
 void
@@ -4881,6 +4890,12 @@ set_jobs_list_frozen (int s)
   jobs_list_frozen = s;
 }
 
+int
+jobs_list_frozen_status (void)
+{
+  return jobs_list_frozen;
+}
+
 /* Allow or disallow job control to take place. Returns the old value
    of job_control. */
 int
diff --git a/jobs.h b/jobs.h
index 2beee642043755f6932a7e781b35abe262312e2c..c096ee73ae16d0c13b20ef5b8491a1e862ad456b 100644 (file)
--- a/jobs.h
+++ b/jobs.h
@@ -297,8 +297,9 @@ extern int give_terminal_to (pid_t, int);
 extern void run_sigchld_trap (int);
 
 extern int freeze_jobs_list (void);
-extern void unfreeze_jobs_list (void);
+extern int unfreeze_jobs_list (void);
 extern void set_jobs_list_frozen (int);
+extern int jobs_list_frozen_status (void);
 extern int set_job_control (int);
 extern void without_job_control (void);
 extern void end_job_control (void);
index c7c12646e84cbd171f435eacce3c54276a696322..b07ff470ea2b0a576fd798dd4485e3e033223c41 100644 (file)
@@ -85,7 +85,8 @@ int _rl_optimize_typeahead = 1;       /* rl_insert tries to read typeahead */
 int
 rl_insert_text (const char *string)
 {
-  register int i, l;
+  register int i;
+  size_t l;
 
   l = (string && *string) ? strlen (string) : 0;
   if (l == 0)
@@ -704,7 +705,11 @@ static mbstate_t ps = {0};
 
 /* Insert the character C at the current location, moving point forward.
    If C introduces a multibyte sequence, we read the whole sequence and
-   then insert the multibyte char into the line buffer. */
+   then insert the multibyte char into the line buffer.
+   If C == 0, we immediately insert any pending partial multibyte character,
+   assuming that we have read a character that doesn't map to self-insert.
+   This doesn't completely handle characters that are part of a multibyte
+   character but map to editing functions. */
 int
 _rl_insert_char (int count, int c)
 {
@@ -718,11 +723,28 @@ _rl_insert_char (int count, int c)
   static int stored_count = 0;
 #endif
 
+#if !defined (HANDLE_MULTIBYTE)
   if (count <= 0)
     return 0;
+#else
+  if (count < 0)
+    return 0;
+  if (count == 0)
+    {
+      if (pending_bytes_length == 0)
+       return 0;
+      if (stored_count <= 0)
+       stored_count = count;
+      else
+       count = stored_count;
 
-#if defined (HANDLE_MULTIBYTE)
-  if (MB_CUR_MAX == 1 || rl_byte_oriented)
+      memcpy (incoming, pending_bytes, pending_bytes_length);
+      incoming[pending_bytes_length] = '\0';
+      incoming_length = pending_bytes_length;
+      pending_bytes_length = 0;
+      memset (&ps, 0, sizeof (mbstate_t));
+    }
+  else if (MB_CUR_MAX == 1 || rl_byte_oriented)
     {
       incoming[0] = c;
       incoming[1] = '\0';
@@ -730,6 +752,9 @@ _rl_insert_char (int count, int c)
     }
   else if (_rl_utf8locale && (c & 0x80) == 0)
     {
+      if (pending_bytes_length)
+       _rl_insert_char (0, 0);
+
       incoming[0] = c;
       incoming[1] = '\0';
       incoming_length = 1;
@@ -764,7 +789,8 @@ _rl_insert_char (int count, int c)
          incoming[1] = '\0';
          incoming_length = 1;
          pending_bytes_length--;
-         memmove (pending_bytes, pending_bytes + 1, pending_bytes_length);
+         if (pending_bytes_length)
+           memmove (pending_bytes, pending_bytes + 1, pending_bytes_length);
          /* Clear the state of the byte sequence, because in this case the
             effect of mbstate is undefined. */
          memset (&ps, 0, sizeof (mbstate_t));
@@ -827,7 +853,7 @@ _rl_insert_char (int count, int c)
       rl_insert_text (string);
       xfree (string);
 
-      return 0;
+      return (pending_bytes_length != 0);
     }
 
   if (count > TEXT_COUNT_MAX)
@@ -860,6 +886,8 @@ _rl_insert_char (int count, int c)
       xfree (string);
       incoming_length = 0;
       stored_count = 0;
+
+      return (pending_bytes_length != 0);
 #else /* !HANDLE_MULTIBYTE */
       char str[TEXT_COUNT_MAX+1];
 
@@ -873,9 +901,9 @@ _rl_insert_char (int count, int c)
          rl_insert_text (str);
          count -= decreaser;
        }
-#endif /* !HANDLE_MULTIBYTE */
 
       return 0;
+#endif /* !HANDLE_MULTIBYTE */
     }
 
   if (MB_CUR_MAX == 1 || rl_byte_oriented)
@@ -903,9 +931,11 @@ _rl_insert_char (int count, int c)
       rl_insert_text (incoming);
       stored_count = 0;
     }
-#endif
-
+  
+  return (pending_bytes_length != 0);
+#else
   return 0;
+#endif
 }
 
 /* Overwrite the character at point (or next COUNT characters) with C.
@@ -985,6 +1015,8 @@ rl_insert (int count, int c)
 
   /* If we didn't insert n and there are pending bytes, we need to insert
      them if _rl_insert_char didn't do that on its own. */
+  if (r == 1 && rl_insert_mode == RL_IM_INSERT)
+    r = _rl_insert_char (0, 0);                /* flush partial multibyte char */
 
   if (n != (unsigned short)-2)         /* -2 = sentinel value for having inserted N */
     {
@@ -1056,6 +1088,8 @@ _rl_insert_next_callback (_rl_callback_generic_arg *data)
 int
 rl_quoted_insert (int count, int key)
 {
+  int r;
+
   /* Let's see...should the callback interface futz with signal handling? */
 #if defined (HANDLE_SIGNALS)
   if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
@@ -1074,15 +1108,15 @@ rl_quoted_insert (int count, int key)
   /* A negative count means to quote the next -COUNT characters. */
   if (count < 0)
     {
-      int r;
-
       do
        r = _rl_insert_next (1);
       while (r == 0 && ++count < 0);
-      return r;
     }
 
-  return _rl_insert_next (count);
+  if (r == 1)
+    _rl_insert_char (0, 0);    /* insert partial multibyte character */
+
+  return r;
 }
 
 /* Insert a tab character. */
index 7a948ebecb0f14e9233a8af642fd9c3a90b74e3c..534fa79a666b39f9187bde56c92eea6e3f6caa2e 100644 (file)
@@ -20,6 +20,9 @@
    
 #include <config.h>
 
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif
 #include <bashansi.h>
 
 ssize_t
index 6ca05ba1bb3de81e42f1c6275b0fe9ea2ce8a934..c480e8601b5819ececf7bf372ab820346706a029 100644 (file)
--- a/nojobs.c
+++ b/nojobs.c
@@ -1016,9 +1016,10 @@ freeze_jobs_list (void)
   return 0;
 }
 
-void
+int
 unfreeze_jobs_list (void)
 {
+  return 0;
 }
 
 void
@@ -1026,6 +1027,12 @@ set_jobs_list_frozen (int s)
 {
 }
 
+int
+jobs_list_frozen_status (void)
+{
+  return 0;
+}
+
 int
 count_all_jobs (void)
 {
diff --git a/parse.y b/parse.y
index d05f0a61b866f1e5840205ed82a96c0826149833..bb7e79eeafc988fffa35bfa49a5bf22fbd07fd9c 100644 (file)
--- a/parse.y
+++ b/parse.y
@@ -6683,10 +6683,15 @@ parse_string_to_word_list (char *s, int flags, const char *whom)
   if (wl == &parse_string_error)
     {
       set_exit_status (EXECUTION_FAILURE);
+      current_token = '\n';    /* XXX */
       if (interactive_shell == 0 && posixly_correct)
        jump_to_top_level (FORCE_EOF);
       else
-       jump_to_top_level (DISCARD);
+       {
+         if (executing && parse_and_execute_level == 0)
+           top_level_cleanup ();
+         jump_to_top_level (DISCARD);
+       }
     }
 
   return (REVERSE_LIST (wl, WORD_LIST *));
@@ -6749,11 +6754,15 @@ parse_compound_assignment (size_t *retlenp)
   if (wl == &parse_string_error)
     {
       set_exit_status (EXECUTION_FAILURE);
-      last_read_token = '\n';  /* XXX */
+      last_read_token = current_token = '\n';  /* XXX */
       if (interactive_shell == 0 && posixly_correct)
        jump_to_top_level (FORCE_EOF);
       else
-       jump_to_top_level (DISCARD);
+       {
+         if (executing && parse_and_execute_level == 0)
+           top_level_cleanup ();
+         jump_to_top_level (DISCARD);
+       }
     }
 
   if (wl)
index afd51b02cfe614fb6fcdd9e9c0a1f46d55e4948c..a19437cf7df30241fef7a66042d89aaf2bfc572a 100644 (file)
Binary files a/po/hr.gmo and b/po/hr.gmo differ
index 65e1aba8dca11cfa9c181bfc00b9ee3e8bcb5e8f..a7e97e5684a1466249c2deebc91da6faf6e76c25 100644 (file)
--- a/po/hr.po
+++ b/po/hr.po
@@ -9,7 +9,7 @@ msgstr ""
 "Project-Id-Version: bash-5.2-rc1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2022-01-11 14:50-0500\n"
-"PO-Revision-Date: 2023-04-12 12:19-0700\n"
+"PO-Revision-Date: 2023-05-01 16:11-0700\n"
 "Last-Translator: Božidar Putanec <bozidarp@yahoo.com>\n"
 "Language-Team: Croatian <lokalizacija@linux.hr>\n"
 "Language: hr\n"
@@ -1731,12 +1731,12 @@ msgid ""
 "Usage:\t%s [GNU long option] [option] ...\n"
 "\t%s [GNU long option] [option] script-file ...\n"
 msgstr ""
-"Uporaba: %s [GNU dugačka opcija] [opcija]...\n"
-"         %s [GNU dugačka opcija] [opcija] skripta...\n"
+"Uporaba: %s [GNU duga opcija] [opcija]...\n"
+"         %s [GNU duga opcija] [opcija] skripta...\n"
 
 #: shell.c:2064
 msgid "GNU long options:\n"
-msgstr "GNU dugačke opcije:\n"
+msgstr "GNU duge opcije:\n"
 
 #: shell.c:2068
 msgid "Shell options:\n"
@@ -2810,10 +2810,10 @@ msgstr ""
 "    naziv, „cd“ prijeđe u direktorij s tim nazivom.\n"
 "\n"
 "    Opcije:\n"
-"      -L    slijedi simboličke veze; simboličke veze u DIREKTORIJU razriješi\n"
+"      -L    slijedi simboličke poveznice; simboličke poveznice u DIREKTORIJU razriješi\n"
 "              nakon obrade instance „..“\n"
 "      -P    rabi fizičku strukturu direktorija umjesto da slijedi simboličke\n"
-"              veze; simboličke veze u DIREKTORIJU razriješi prije obrade\n"
+"              poveznice; simboličke poveznice u DIREKTORIJU razriješi prije obrade\n"
 "              instance „..“\n"
 "      -e    ako je dana s opcijom „-P“, i trenutni radni direktorij nije\n"
 "              moguće uspješno odrediti nakon uspješne promjene direktorija,\n"
@@ -2849,7 +2849,7 @@ msgstr ""
 "\n"
 "    Opcije:\n"
 "      -L   ispiše vrijednost od $PWD ako sadrži trenutni radni direktorij\n"
-"      -P   ispiše stvarnu fizičku stazu do direktorija bez simboličkih veza\n"
+"      -P   ispiše stvarnu fizičku stazu do direktorija bez simboličkih poveznica\n"
 "\n"
 "    Bez opcija, „pwd“ se ponaša kao da je navedena opcija „-L“\n"
 "\n"
@@ -3947,8 +3947,8 @@ msgstr ""
 "            (a ne samo one argumente koji prethode imenu naredbe)\n"
 "      -m  upravljanje poslovima je omogućeno (zadano)\n"
 "      -n  pročita, ali ne izvrši naredbe\n"
-"      -o  IME_OPCIJE  omogući tu opciju (v. niže dugačke nazive za IME_OPCIJE)\n"
-"      -P  ne razriješi simboličke veze pri izvršavanju naredbi poput „cd“\n"
+"      -o  IME_OPCIJE  omogući tu opciju (v. niže duge nazive za IME_OPCIJE)\n"
+"      -P  ne razriješi simboličke poveznice pri izvršavanju naredbi poput „cd“\n"
 "            koje promjene trenutni direktorij\n"
 "      -p  uključi privilegirani način: datoteke BASH_ENV i ENV se zanemare,\n"
 "            funkcije ljuske se ne uvoze iz okoline, a zanemari se i\n"
@@ -3966,11 +3966,11 @@ msgstr ""
 "            parametri (ali ako ih nema, postojeći pozicijski argumenti\n"
 "            se ne brišu)\n"
 "\n"
-"    Opcije se također mogu koristiti pri pokretanju ljuske. Trenutno stanje\n"
+"    Opcije se mogu koristiti i pri pokretanju ljuske. Trenutno stanje\n"
 "    svojstva može se naći u $-. Podrazumijeva se da su svi dodatni argumenti\n"
 "    pozicijski i dodijeljeni su u $1, $2, .. $N.\n"
 "\n"
-"    Dugački nazivi za IME_OPCIJE koji se koriste s opcijom -o (ili +o)\n"
+"    Dugi nazivi za IME_OPCIJE koji se koriste s opcijom -o (ili +o)\n"
 "      allexport    == -a\n"
 "      braceexpand  == -B (zamjena vitičastih zagrada)\n"
 "      emacs        za uređivanje redaka koristi sučelje u „emacs“ stilu\n"
@@ -4272,9 +4272,9 @@ msgstr ""
 "        -f DATOTEKA       istina ako je datoteka regularna datoteka\n"
 "        -G DATOTEKA       istina ako je datoteka efektivno vlasništvo vaše skupine\n"
 "        -g DATOTEKA       istina ako je datoteka SETGUID\n"
-"        -h DATOTEKA       istina ako je datoteka simbolička veza\n"
+"        -h DATOTEKA       istina ako je datoteka simbolička poveznica\n"
 "        -k DATOTEKA       istina ako datoteka ima postavljeni \"sticky\" bit\n"
-"        -L DATOTEKA       istina ako je datoteka simbolička veza\n"
+"        -L DATOTEKA       istina ako je datoteka simbolička poveznica\n"
 "        -N DATOTEKA       istina ako se datoteka promijenila od zadnjeg čitanja\n"
 "        -O DATOTEKA       istina ako je datoteka efektivno vaše vlasništvo\n"
 "        -p DATOTEKA       istina ako je datoteka imenovana cijev\n"
@@ -4290,7 +4290,7 @@ msgstr ""
 "                            kasnije od druge\n"
 "      DTEKA1 -ot DTEKA2   istina ako je prva datoteka promijenjena\n"
 "                            ranije od druge\n"
-"      DTEKA1 -ef DTEKA2   istina ako je prva datoteka čvrsta veza na drugu\n"
+"      DTEKA1 -ef DTEKA2   istina ako je prva datoteka čvrsta poveznica na drugu\n"
 "\n"
 "    Operatori za stringove:\n"
 "        -z STRING         istina ako je string prazni\n"
@@ -5270,7 +5270,7 @@ msgstr ""
 "      -u   onemogući (isključi) sve navedene IME_OPCIJE\n"
 "\n"
 "    Bez opcija (ili samo s opcijom „-q“) završi s uspjehom ako je IME_OPCIJE\n"
-"    omogućeno, a s 1 ako je onemogućeno. Završi također s 1 ako je dano\n"
+"    omogućeno, a s 1 ako je onemogućeno. Završi s 1 i ako je dano\n"
 "    nevaljano IME_OPCIJE, a završi s 2 ako je dana nevaljana opcija."
 
 #: builtins.c:1938
diff --git a/sig.c b/sig.c
index 31b95adb7b92fd8ff018b935fc3b77ff82b940c3..279eaadf64450c9d35b5791412bcb8d8723fd3c0 100644 (file)
--- a/sig.c
+++ b/sig.c
@@ -398,6 +398,7 @@ top_level_cleanup (void)
   loop_level = continuing = breaking = funcnest = 0;
   interrupt_execution = retain_fifos = 0;
   comsub_ignore_return = return_catch_flag = wait_intr_flag = 0;
+  variable_context = 0;                /* XXX */
 }
 
 /* What to do when we've been interrupted, and it is safe to handle it. */
@@ -465,6 +466,7 @@ throw_to_top_level (void)
   loop_level = continuing = breaking = funcnest = 0;
   interrupt_execution = retain_fifos = 0;
   comsub_ignore_return = return_catch_flag = wait_intr_flag = 0;
+  variable_context = 0;
 
   if (interactive && print_newline)
     {