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

Fish gives warning at start on Haiku #3317

Closed
2 tasks done
extrowerk opened this issue Aug 21, 2016 · 22 comments
Closed
2 tasks done

Fish gives warning at start on Haiku #3317

extrowerk opened this issue Aug 21, 2016 · 22 comments
Assignees
Milestone

Comments

@extrowerk
Copy link
Contributor

extrowerk commented Aug 21, 2016

  • Have you checked if problem occurs with fish 2.3.1?
  • Tried fish without third-party customizations (check sh -c 'env HOME=$(mktemp -d) fish')?

fish version installed (fish --version):
2.3.1
OS/terminal used:
Haiku gcc2h, hrev50498, with gcc 5.4.0

At starting fish in Haiku terminal i get the following:

socket: Address family not supported by protocol family
socket: Address family not supported by protocol family
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

Reproduction steps

Hard to explain? Link to a screen recording

  1. Launch fish
  2. Read the warnings
  3. ???
  4. Solve the warnings
  5. Profit

Expected results

Fish should not write warnings to the terminal.

Actual results

~ $ math 2 + 2

4
(but just on my laptop, the real result could be something else, so no guarantee. The result here is under MIT license.

@zanchey
Copy link
Member

zanchey commented Aug 21, 2016

I wonder if Haiku supports UNIX domain sockets? That would be the first thing to check.

@extrowerk
Copy link
Contributor Author

As far as i know Haiku supports Unix domain sockets.
Here is my actual recipe for fish: haikuports/haikuports#776

@extrowerk
Copy link
Contributor Author

Yes, Haiku support the unix domain sockets: http://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/network/protocols/unix

@floam
Copy link
Member

floam commented Aug 21, 2016

Can you run fish with fish -d2 -D2 from git HEAD and share the output?

@floam
Copy link
Member

floam commented Aug 21, 2016

It's got to be the crazy assumptions we make in env_universal_common.cpp.

@floam
Copy link
Member

floam commented Aug 21, 2016

I had noticed when debugging the issue with FreeBSD 11 that on that VM (my interfaces were re0 if I used one driver, something else that was different with another) that this was failing, so it was falling back to having to use just the hostname for naming the uvar file. It seemed a bit of an assumption that it maps to the platform the way we hope:

https://github.com/fish-shell/fish-shell/blob/master/src/env_universal_common.cpp#L902-L930

#ifdef SIOCGIFHWADDR
// Linux
#include <net/if.h>
static bool get_mac_address(unsigned char macaddr[MAC_ADDRESS_MAX_LEN],
                            const char *interface = "eth0") {
    bool result = false;
    const int dummy = socket(AF_INET, SOCK_STREAM, 0);
...

}
#elif defined(HAVE_GETIFADDRS)
// OS X and BSD
#include <ifaddrs.h>
#include <net/if_dl.h>
static bool get_mac_address(unsigned char macaddr[MAC_ADDRESS_MAX_LEN],
                            const char *interface = "en0") {
    // BSD, Mac OS X
    struct ifaddrs *ifap;
    bool ok = false;
}

@floam
Copy link
Member

floam commented Aug 21, 2016

Though it seems it is just the preprocessor picking by HAVE_GETIFADDRS/SIOCGIFHWADDR and whatever we do when inside of get_mac_address itself is not OK on Haiku.

@extrowerk
Copy link
Contributor Author

floam, thanks for your help.
Have you seen my patch file for Haiku? Look here: https://github.com/miqlas/haikuports/blob/d4bb14e6a6ca5753759139f15197d4323fb23a85/app-shells/fish/patches/fish-2.3.1.patchset

@floam
Copy link
Member

floam commented Aug 21, 2016

I hadn't.

@extrowerk
Copy link
Contributor Author

extrowerk commented Aug 21, 2016

Ok, here is the fish -d2 -D2 output:

`
~/D/fish-shell ❯❯❯ /boot/home/Desktop/fishinst/bin/fish -d2 -D2 >log.txt
<2> fish: handle_curses() called in response to 'TERM' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: curses var TERM='xterm'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() called in response to 'LC_TIME' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: locale var LC_TIME='hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() setlocale(): 'hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() called in response to 'LC_NUMERIC' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: locale var LC_NUMERIC='hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() setlocale(): 'hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() called in response to 'LC_MONETARY' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: locale var LC_MONETARY='hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() setlocale(): 'hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() called in response to 'LC_MESSAGES' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: locale var LC_MESSAGES='hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() setlocale(): 'hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() called in response to 'LC_CTYPE' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: locale var LC_CTYPE='hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() setlocale(): 'hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() called in response to 'LC_COLLATE' changing
<2> fish: Sorry, but your system does not support backtraces
<2> fish: locale var LC_COLLATE='hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: handle_locale() setlocale(): 'hu.UTF-8'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: 256 color support enabled for TERM=xterm
<2> fish: Sorry, but your system does not support backtraces
<2> fish: sourcing /boot/home/Desktop/fishinst/share/fish/config.fish
<2> fish: Sorry, but your system does not support backtraces
<2> fish: sourcing /boot/home/Desktop/fishinst/etc/fish/config.fish
<2> fish: Sorry, but your system does not support backtraces
<2> fish: not sourcing /boot/home/.config/fish/config.fish (not readable or does not exist)
<2> fish: Sorry, but your system does not support backtraces
socket: Address family not supported by protocol family
socket: Address family not supported by protocol family
<2> fish: 256 color support enabled for TERM=xterm
<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #1, pid 8226: external command 'u' from '/boot/home/Desktop/fishinst/share/fish/functions/__fish_pwd.fish'

<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #2, pid 8227: keepalive fork for 'echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #3, pid 8228: internal builtin for 'echo'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #4, pid 8229: external command '/' from '-'

<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #5, pid 8230: internal builtin for 'command'
<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #6, pid 8231: external command 's' from ''

<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #7, pid 8232: external command 's' from ''

<2> fish: Sorry, but your system does not support backtraces
<2> fish: Fork #8, pid 8233: external command 's' from ''

<2> fish: Sorry, but your system does not support backtraces
`

@extrowerk
Copy link
Contributor Author

extrowerk commented Aug 21, 2016

Yes, you have right, the interfaces could have different names.
In VmWare under Haiku it is : /dev/net/pcnet/0. So yeah, it is a bit different than in the *nixes, and it depends on the used driver. It must be a way to get the interface name in Haiku, but i'm not sure if there is a posix way for that.

@ridiculousfish
Copy link
Member

Cool, nice patch! Thanks for writing that!

The check for __HAIKU__ can go away - the MAP_FILE one can be standard in config.h and the p->ifa_addr check can be used for all platforms.

@ridiculousfish ridiculousfish added this to the next-2.x milestone Aug 27, 2016
@ridiculousfish ridiculousfish self-assigned this Aug 27, 2016
@extrowerk
Copy link
Contributor Author

It is already committed: a872d9c

But terer is something wrong with the IPV6 support in Haiku, and the warnings aren't nice at the start.

@zanchey
Copy link
Member

zanchey commented Aug 30, 2016

Fixing the MAP_FILE issue will also help on Solaris/IllumOS (#3340).

zanchey added a commit that referenced this issue Aug 30, 2016
MAP_FILE is unspecified or ignored on Linux, Solaris, FreeBSD and Haiku;
it is the default on OS X.

Work on #3317 & #3340.
@extrowerk
Copy link
Contributor Author

Any other idea about the warning? I'm just a bit tired about it.

@zanchey
Copy link
Member

zanchey commented Oct 2, 2016

Can you show the current warnings? I imagine it's something along the lines of socket: Address family not supported by protocol family ?

@extrowerk
Copy link
Contributor Author

There is nothing else there.

@extrowerk
Copy link
Contributor Author

The warning happens here:
https://github.com/fish-shell/fish-shell/blob/master/src/fish.cpp#L210

In the latest haiku patch i just commented this line out. I know it isn't ideal, but it doesn't break anything, and it will never upstreamed.

Btw i'm all ears if somebody have better idea how to silence the wrnings.

@extrowerk
Copy link
Contributor Author

extrowerk commented Dec 22, 2016

Haiku supports only AF_UNIX SOCKS_STREAM, but not the required SOCK_DGRAM. That not implemented yet, that's why i get the warnings at start.

See here: https://github.com/haiku/haiku/blob/master/src/add-ons/kernel/network/protocols/unix/unix.cpp#L435

@extrowerk
Copy link
Contributor Author

I think we can close this issue.

@ridiculousfish
Copy link
Member

The socket code is super-old at this point and only used to detect old versions of fish running. I think we can remove it at this point. #3669 tracks removing it.

@extrowerk
Copy link
Contributor Author

Oh, thanks for the info, i had no idea, why this socket handling code required.
It would be great to not get warnings all the time if i start a terminal. it is just a bit disturbing.
Thanks again!

nomaed pushed a commit to nomaed/fish-shell that referenced this issue Jul 17, 2017
MAP_FILE is unspecified or ignored on Linux, Solaris, FreeBSD and Haiku;
it is the default on OS X.

Work on fish-shell#3317 & fish-shell#3340.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants