Comments (4)
Cannot reproduce:
mikebook # brew upgrade lilypond-unstable
==> Downloading https://formulae.brew.sh/api/formula.jws.json
#=#=- #
==> Downloading https://formulae.brew.sh/api/cask.jws.json
#=#=- #
==> Upgrading 1 outdated package:
nwhetsell/lilypond/lilypond-unstable 2.25.13 -> 2.25.14
==> Fetching nwhetsell/lilypond/lilypond-unstable
==> Downloading https://github.com/nwhetsell/homebrew-lilypond/releases/download/lilypond-unstable-2.2
Already downloaded: /opt/workbrew/home/Library/Caches/Homebrew/downloads/a4adb36076d79d01ef065b9c904b0e7085b7557be98daba79c1a35d5fc2aede1--lilypond-unstable-2.25.14.arm64_sonoma.bottle.tar.gz
==> Upgrading nwhetsell/lilypond/lilypond-unstable
2.25.13 -> 2.25.14
- This issue's title and/or description do not reference a single formula e.g.
brew install wget
.
Please ensure you can reproduce this sort of things with multiple core formulae in future.
from brew.
@MikeMcQuaid Thank you for taking a look at this and for all your work on Homebrew.
I’m not sure why this wasn’t reproducible (sorry about that!), but having taken a closer look, the nature of (what seems to be) the issue suggests that it may not be possible to reproduce this with core formulae, because there is no core formula with a sufficiently long name. The fundamental issue appears to be that a string that contains a newline is passed to Tty.truncate
, which then truncates the string as if it was too long for a terminal.
It looks like the affected upgrade message is printed here:
oh1 <<~EOS
Upgrading #{Formatter.identifier(formula.full_specified_name)}
#{version_upgrade} #{fi_options.to_a.join(" ")}
EOS
oh1
passes its argument to oh1_title
here:
def oh1(title, truncate: :auto)
puts oh1_title(title, truncate:)
end
oh1_title
passes the title
argument to Tty.truncate
here:
title = Tty.truncate(title.to_s) if $stdout.tty? && !verbose && truncate == :auto
In this case, the title
being truncated is
Upgrading nwhetsell/lilypond/lilypond-unstable
2.25.13 -> 2.25.14
That’s 68 characters (note the space character after the version number on the 2nd line). However, there are 5 more characters after Upgrading
for the ANSI escape of green, and an additional 5 characters to restore text color at the end of the first line. With the newline at the end of the string, that brings the total to 79 characters:
Characters
Character index | ASCII code (decimal) | Character |
---|---|---|
0 | 85 | U |
1 | 112 | p |
2 | 103 | g |
3 | 114 | r |
4 | 97 | a |
5 | 100 | d |
6 | 105 | i |
7 | 110 | n |
8 | 103 | g |
9 | 32 | |
10 | 27 | ESC |
11 | 91 | [ |
12 | 51 | 3 |
13 | 50 | 2 |
14 | 109 | m |
15 | 110 | n |
16 | 119 | w |
17 | 104 | h |
18 | 101 | e |
19 | 116 | t |
20 | 115 | s |
21 | 101 | e |
22 | 108 | l |
23 | 108 | l |
24 | 47 | / |
25 | 108 | l |
26 | 105 | i |
27 | 108 | l |
28 | 121 | y |
29 | 112 | p |
30 | 111 | o |
31 | 110 | n |
32 | 100 | d |
33 | 47 | / |
34 | 108 | l |
35 | 105 | i |
36 | 108 | l |
37 | 121 | y |
38 | 112 | p |
39 | 111 | o |
40 | 110 | n |
41 | 100 | d |
42 | 45 | - |
43 | 117 | u |
44 | 110 | n |
45 | 115 | s |
46 | 116 | t |
47 | 97 | a |
48 | 98 | b |
49 | 108 | l |
50 | 101 | e |
51 | 27 | ESC |
52 | 91 | [ |
53 | 51 | 3 |
54 | 57 | 9 |
55 | 109 | m |
56 | 10 | LF |
57 | 32 | |
58 | 32 | |
59 | 50 | 2 |
60 | 46 | . |
61 | 50 | 2 |
62 | 53 | 5 |
63 | 46 | . |
64 | 49 | 1 |
65 | 51 | 3 |
66 | 32 | |
67 | 45 | - |
68 | 62 | > |
69 | 32 | |
70 | 50 | 2 |
71 | 46 | . |
72 | 50 | 2 |
73 | 53 | 5 |
74 | 46 | . |
75 | 49 | 1 |
76 | 52 | 4 |
77 | 32 | |
78 | 10 | LF |
A common terminal width is 80 characters (the default width in Tty
), Tty.truncate
truncates strings to have 4 fewer characters than the terminal width, so truncated strings typically have 76 characters. When the affected message is truncated to 76 characters, the last character (at index 75) happens to be the penultimate digit of the new version number, so it appears that the last digit is omitted.
from brew.
@nwhetsell We'd review a PR to make the second line of the oh1
a plain old puts
instead (the first line should continue to use oh1
and be truncated when necessary.
from brew.
That’s 68 characters (note the space character after the version number on the 2nd line). However, there are 5 more characters after
Upgrading
for the ANSI escape of green, and an additional 5 characters to restore text color at the end of the first line. With the newline at the end of the string, that brings the total to 79 characters:
Ideally we wouldn't count non-printable characters when deciding where to truncate strings but that's not the main issue here.
from brew.
Related Issues (20)
- `brew upgrade -g` sometime will install old version app HOT 3
- `brew upgrade -g` sometime will install old version app
- @PizzaShift @ligi Hello.
- Support GitHub App installation access tokens HOT 2
- Command "brew update" shows "/dev/stdin: No such file or directory - /tmp/sh-thd-2853475760 (deleted) (Errno::ENOENT)" HOT 8
- How should we store installed cask information? HOT 18
- Integrating attestation verification into `brew install` (and `brew verify`) HOT 17
- `brew bump --open-pr` fails to fetch repology data HOT 5
- Add a RuboCop rule for sorting EnvConfig keys
- Make `update <formula>` actually `upgrade formula` HOT 2
- `brew info` should always print whether formula installed HOT 5
- `cask upgrade` will be downloaded and installed repeatedly HOT 10
- `brew log` regression after port to `abstract_command` HOT 1
- option to install package to home directory or a custom directory HOT 1
- Running the macOS installer changes permissions on `~/.gitconfig` HOT 5
- Introduce additional versioning information for casks HOT 6
- Using kickstart? HOT 4
- Add `brew asdf-sync`; equivalent to `brew nodenv-sync` / `brew pyenv-sync` / `brew rbenv-sync` HOT 2
- simple command to list all user installed items (not installed only as dependency) HOT 4
- Add new url scheme for the GitDownloadStrategy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brew.