[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Incorrect Printing of esac in pretty-print mode
From: |
Seth Sabar |
Subject: |
Incorrect Printing of esac in pretty-print mode |
Date: |
Tue, 27 Feb 2024 16:05:25 -0500 |
Hi,
I'm reaching out to report a bug with the -*-pretty-print* option in bash.
Consider the following script:
*case esac in (esac) echo esac;; esac*
When bash is run with *--pretty-print* on this script the result is:
*case esac in esac) echo esac ;;esac*
which is no longer valid syntax. This is interesting because running pretty
print mode on this script:
*case esac in (nonkeyword) echo esac;; esac*
similarly results in
*case esac in nonkeyword) echo esac ;;esac*
which is valid syntax. So what's happening is that when the parser sees
esac as what's supposed to be a pattern it interprets it as the case
command ending and everything following is bad syntax.
Personally, based on the Bash manual, I find it a little unclear whether
*case esac in esac) echo esac ;;esac*
is valid syntax or not. However, assuming that it is indeed invalid syntax
the bug fix should be as simple as special casing *esac* as a *clause
*in *print_case_clauses
*in *print_cmd.c*.
Best,
Seth
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Incorrect Printing of esac in pretty-print mode,
Seth Sabar <=