Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watch: UTF-8 support broken #7178

Closed
zeha opened this issue Nov 23, 2016 · 4 comments
Closed

watch: UTF-8 support broken #7178

zeha opened this issue Nov 23, 2016 · 4 comments
Labels
upstream issue An upstream issue report is needed

Comments

@zeha
Copy link
Contributor

zeha commented Nov 23, 2016

Bug reports:

The watch binary from the watch formula on Sierra fails to display non-ASCII characters (i.e. UTF-8 umlauts, etc.). As this works on Linux, I'd say this is a build environment issue.

Installed from watch-3.3.12.sierra.bottle.tar.gz, also happens when installing with brew install --HEAD watch.

Repro:

cat > ~/test.sh <<EOT
echo "höllö!" 
EOT

watch -n2 bash ~/test.sh

Notice that the displayed string is either "hllo!" or "h ll o!" depending on your Terminal.app settings, but never the expected "höllö!".

@MikeMcQuaid
Copy link
Member

Does it work when built from source outside of Homebrew on macOS?

@ilovezfs ilovezfs added the upstream issue An upstream issue report is needed label Nov 24, 2016
@apjanke
Copy link
Contributor

apjanke commented Nov 28, 2016

I can reproduce zeha's issue. Doesn't work for me when built outside Homebrew either.

I think the issue is that its configure logic doesn't recognize macOS's ncurses library as providing wide character support, even though it does, and assumes a separate ncursesw library is required.

There's an --enable-watch8bit configure option which looks like it enables wide character support.

E.g., in watch.c:

#ifdef WITH_WATCH8BIT
# define _XOPEN_SOURCE_EXTENDED 1
# include <wchar.h>
# include <wctype.h>
#endif	/* WITH_WATCH8BIT */

However, when using that switch, configure fails. Looks like it's looking for a separate ncursesw library.

[~/tmp/procps-ng/procps on ⇄ master]
$ ./configure --prefix=/tmp/test-watch --enable-watch8bit
...
checking for NCURSES... no
checking for initscr in -lncurses... yes
checking for curses.h... yes
checking for ncurses.h... yes
checking for term.h... yes
checking for NCURSESW... no
checking for addwstr in -lncursesw... no
configure: error: Cannot find ncurses wide library ncursesw with --enable-watch8bit

Seems like basically the same upstream issue as hishamhm/htop#301.

If I modify the watch formula to have depends_on "homebrew/dupes/ncurses" (which does have a separate libncursesw) and add the --enable-watch8bit, then it builds, and UTF-8 display using OP's test code works for me.

Sounds like this should be reported upstream as an incompatibility with macOS's ncurses library.

@apjanke
Copy link
Contributor

apjanke commented Nov 28, 2016

Reported upstream: https://gitlab.com/procps-ng/procps/issues/47

@MikeMcQuaid
Copy link
Member

I can reproduce zeha's issue. Doesn't work for me when built outside Homebrew either.

Thanks @apjanke. Closing as not a Homebrew issue.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
upstream issue An upstream issue report is needed
Projects
None yet
Development

No branches or pull requests

4 participants