Repository: Homebrew/homebrew-core

Issue #111924: `brew install poetry` - completion.d - `unexpected token `clear'`
Created: 2022-09-28T22:48:53Z
brew gist-logs <formula> link OR brew config AND brew doctor output
$ brew gist-logs poetry
Error: No logs.

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed manually.
You should find replacements for the following formulae:
  unrar




### Verification

- [X] I ran `brew update` and am still able to reproduce my issue.
- [X] I have resolved all warnings from `brew doctor` and that did not fix my problem.

### What were you trying to do (and why)?

Open an interactive terminal.

### What happened (include all command output)?


Last login: Wed Sep 28 23:19:55 on ttys004
-bash: /usr/local/etc/bash_completion.d/poetry: line 40: syntax error near unexpected token clear' -bash: /usr/local/etc/bash_completion.d/poetry: line 40:             (cache clear)'
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.

### What did you expect to happen?


Last login: Wed Sep 28 23:19:55 on ttys004
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.

### Step-by-step reproduction instructions (by running `brew` commands)

```shell
Running `brew update --auto-update`... updated poetry


==> Upgrading poetry
  1.1.13 -> 1.2.1

After this update open a new interactive terminal I am presented with:
-bash: /usr/local/etc/bash_completion.d/poetry: line 40: syntax error near unexpected token `clear'
-bash: /usr/local/etc/bash_completion.d/poetry: line 40: `            (cache clear)'


Removing poetry 1.2.1 removes this error when opening a new interative terminal.
I can reproduce this by simply installing poetry 1.2.1 (using brew)
$ brew install poetry
==> Downloading https://ghcr.io/v2/homebrew/core/poetry/manifests/1.2.1
Already downloaded: /Users/jim.smith/Library/Caches/Homebrew/downloads/cb708b02063419e7b2696d992f105d566d83aad8eaa011d135aeae3901f1be7c--poetry-1.2.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/poetry/blobs/sha256:d66508f0eb043a1be17f82e0e466ab81e69c52fabc74141cc1fe5770a53777ce
Already downloaded: /Users/jim.smith/Library/Caches/Homebrew/downloads/2e4d80a7b07be94f8917af6c8d7efd235c61c55f46fb50935eb3071c055ad6c2--poetry--1.2.1.monterey.bottle.tar.gz
==> Pouring poetry--1.2.1.monterey.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/poetry/1.2.1: 2,192 files, 29.7MB
==> Running `brew cleanup poetry`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Duplicate issue #113711: Broken Bash completion for *poetry*
Created: 2022-10-21T15:35:14Z
brew gist-logs <formula> link OR brew config AND brew doctor output
Output of brew config
HOMEBREW_VERSION: >=2.5.0 (shallow or no git repository)
ORIGIN: (none)
HEAD: (none)
Last commit: never
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: (none)
Core tap last commit: never
Core tap branch: (none)
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BROWSER: open -a Firefox.app
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.jAXNwUkjFX/org.xquartz:0
HOMEBREW_EDITOR: mate_wait
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.38.1 => /opt/homebrew/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.6-arm64
CLT: 14.0.0.0.1.1661618636
Xcode: 13.4.1
Rosetta 2: false
Output of brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  subliminal

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/alex/.cargo/bin/cargo-install-update-config

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/BandedSmithWaterman.h
  /usr/local/include/BedReader.h
  /usr/local/include/Fasta.h
  /usr/local/include/IndelAllele.h
  /usr/local/include/IntervalTree.h
  /usr/local/include/LargeFileSupport.h
  /usr/local/include/LeftAlign.h
  /usr/local/include/Mosaik.h
  /usr/local/include/Region.h
  /usr/local/include/Repeats.h
  /usr/local/include/SmithWatermanGotoh.h
  /usr/local/include/Variant.h
  /usr/local/include/disorder.h
  /usr/local/include/filevercmp.h
  /usr/local/include/join.h
  /usr/local/include/makeUnique.h
  /usr/local/include/mt19937ar.h
  /usr/local/include/multichoose.h
  /usr/local/include/multipermute.h
  /usr/local/include/vec128int.h
  /usr/local/include/veclib_types.h
Verification

 I ran brew update and am still able to reproduce my issue.
 I have resolved all warnings from brew doctor and that did not fix my problem. (Actually no, but warnings are unavoidable and clearly not relevant to issue!)

What were you trying to do (and why)?
Use tab-completion for Poetry (installed as part of formula).
What happened (include all command output)?
Open new Bash shell. The following is output.
-bash: /opt/homebrew/etc/bash_completion.d/poetry: line 40: syntax error near unexpected token `clear'
-bash: /opt/homebrew/etc/bash_completion.d/poetry: line 40: `            (cache clear)'
What did you expect to happen?
No error
Step-by-step reproduction instructions (by running brew commands)
brew install poetry
# Then just open a new Bash shell and observe the error message, per above.

Closing comment (2022-10-21T15:57:31Z): Duplicate of #111924