Mic92 / python-mpd2

Python library which provides a client interface for the Music Player Daemon.
GNU Lesser General Public License v3.0
352 stars 119 forks source link

Implement abstract socket support #193

Closed aurieh closed 2 years ago

aurieh commented 2 years ago

The @ prefix is an mpd convention: it is used in mpd.conf bind_to_address and by libmpdclient (and everything downstream: mpc etc...). It doesn't hurt to be more permissive and accept paths starting with the NUL byte as well, as that's the Linux socket API convention and doesn't violate mpd2's backwards compatibility anyways.

Regarding backwards compatibility: for mpd.base, this should not be a breaking change: @ is not allowed in hostnames and connect(host) only accepts absolute paths. However, this may be a breaking change for mpd.asyncio users: the current implementation of connect(host) only checks for presence of the path separator / in host, meaning it accepts relative paths. I purposefully did not change this behavior in order to ensure the PR remains focused on one feature but this does mean that there is potential for backwards incompatibility when connecting to a path relative to cwd with a name starting with @. Of course, this is a pretty unlikely edge case, but I thought it'd be worth mentioning.

I did not notice any tests specifically testing connect() behavior in mpd/tests.py and therefore did not add my own. If I should add a test for this new feature, do let me know.

Mic92 commented 2 years ago

Thx!