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

musl: getent should support the `-s' switch #1924

Closed
wknapik opened this issue Aug 18, 2018 · 1 comment
Closed

musl: getent should support the `-s' switch #1924

wknapik opened this issue Aug 18, 2018 · 1 comment
Labels
wontfix This will not be worked on

Comments

@wknapik
Copy link

wknapik commented Aug 18, 2018

System

  • xuname:
    Void 4.18.1-arch1-1-ARCH x86_64-musl GenuineIntel notuptodate r
    (I'm just using the voidlinux/voidlinux-musl docker image for testing)
  • package:
    musl

Expected behavior

  • getent -s dns hosts eff.org
198.100.177.181 eff.org
  • getent -s files hosts localhost
127.0.0.1       localhost.localdomain localhost

Actual behavior

  • getent -s dns hosts eff.org
getent: Unknown database `-s': No error information
Usage: getent database [key ...]
        database may be one of:
                ethers group hosts networks passwd protocols services
                shells
  • getent -s files hosts localhost
getent: Unknown database `-s': No error information
Usage: getent database [key ...]
        database may be one of:
                ethers group hosts networks passwd protocols services
                shells

Steps to reproduce the behavior

See: above

Further explanation

Since there doesn't seem to be an upstream repo for musl getent, I opened an issue against Alpine and this one for Void. From the Alpine issue:

glibc getent supports a -s switch for choosing services - this feature is missing in the getent implementation from musl-utils.

I use getent to resolve host names in a script and use -s to query either the /etc/hosts file (getent -s files hosts <hosts>), or actual DNS (getent -s dns hosts <hosts>).

The former could be worked around by parsing the hosts file (at the cost of additional code), but there's no way to skip the hosts file lookup to cover the latter case.
Of course, I could use a tool like host/dig, but I intentionally chose getent, to avoid the additional dependency on bind-tools.

Any chance of this feature being added ?

Please see the Alpine issue for further discussion:
https://bugs.alpinelinux.org/issues/9278

PS. I believe this is even more relevant for Void, since it's available both in musl- and glibc-flavor.

@Gottox
Copy link
Member

Gottox commented Oct 18, 2018

musl does not provide a way to select the sources of a host and I don't think it's feasable to implement a parser /etc/resolv.conf just to have such a switch.

@Gottox Gottox closed this as completed Oct 18, 2018
@Gottox Gottox added the wontfix This will not be worked on label Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants