Bug#990635: kakoune: Fatal error: unable to bind listen socket Permission denied

2021-07-03 Thread xiscu
Package: kakoune
Version: 2020.01.16-2
Followup-For: Bug #990635

Dear Maintainer,
thanks for the fast response. Here the tests (on fish):

1. ACK :
ls -ld /run/user/1000/kakoune/
drwx--x--x 2 root root 40 Jun 21 18:11 /run/user/1000/kakoune//

2. Changed to user and group and now kakoune (kak cmd) works
for me (that only user in the system, personal machine).

Thanks for mantaining kakoune for debian (I would love to see
kakoune, or at least the ideas, working and its concepts also
intregated on other IDEs!)

xiscu



-- System Information:
Debian Release: 11.0
  APT prefers testing
  APT policy: (900, 'testing'), (10, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-6-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages kakoune depends on:
ii  libc6 2.31-12
ii  libgcc-s1 10.2.1-6
ii  libncursesw6  6.2+20201114-2
ii  libstdc++610.2.1-6
ii  libtinfo6 6.2+20201114-2

kakoune recommends no packages.

kakoune suggests no packages.

-- no debconf information



Bug#990635: kakoune: Fatal error: unable to bind listen socket Permission denied

2021-07-03 Thread Peter Pentchev
On Sat, Jul 03, 2021 at 04:03:07PM +0300, Peter Pentchev wrote:
> Control: tag -1 confirmed upstream patch pending
> 
> On Sat, Jul 03, 2021 at 01:39:49PM +0200, xiscu wrote:
> > Package: kakoune
> > Version: 2020.01.16-2
> > Severity: grave
> > Justification: renders package unusable
> > 
> > Dear Maintainer,
> > i'm currently unable to use kakoune as it gives a Permission denied error 
> > on start
> > (reinstalling the package hasn't solved the problem). The programm worked 
> > for me,
> > but currently i get:
> > 
> > Fatal error: unable to bind listen socket '/run/user/1000/kakoune/3781950': 
> > Permission denied
> 
> Hi,
> 
> Yes, you did stumble into an upstream kakoune bug that is fixed in
> a later upstream release that is not in Debian yet. The problem is that
> Kakoune determines the name of a "user-specific directory to put some
> stuff in" using your desktop environment's idea of a "user-specific
> directory to put some stuff in", i.e. the XDG_RUNTIME_DIR environment
> variable that is set upon the start of your GUI session. However, if you
> *first* run `sudo kak something` (and you have told sudo to preserve
> the environment variables!) or `su kak something` (and su, by default,
> does preserve the environment variables), as the first thing you do
> after restarting your computer, before running Kakoune as yourself,
> then Kakoune will create its own directory while running as root, and
> the directory will not be writable by your actual user account.
> So if later you run it from your user account, it will not be able to
> put stuff into that directory. This has happened with other tools, too,
> and this is actually part of the reason why sudo does NOT preserve all
> the environment variables by default. (Note: I'm not saying "don't use
> su, use sudo!"; I'm just saying "su does some weird things by default,
> sudo tries to prevent some problems by doing *other* weird things by
> default, and it is not always the better choice, but it does help
> prevent *some* problems")
> 
> I will test and adapt the patches for this problem...

FTR, just to have it out there before I upload the bugfix version,
the patches in question are:

  
https://github.com/mawww/kakoune/commit/7751c7e188bfc7b2f7e4a70e33032677d84597e5
  
https://github.com/mawww/kakoune/commit/db9ef82398a08bdf985ff26bfb230fb0cd1221a5

> ...but in the meantime,
> a short-term solution for your current situation is:
> 
> 1. Make sure the problem is what I think it is:
> 
>ls -ld /run/user/1000/kakoune
> 
>...and check that it is owned by "root", not by your user account
> 
> 2. Change its owner to your user account:
> 
>sudo chown "$(id -un):$(id -gn)" /run/user/1000/kakoune
> 
>or, if using su:
> 
>su -c "chown '$(id -un)' /run/user/1000/kakoune"

...arrgh, *of course* this should have been:

su -c "chown '$(id -un):$(id -gn)' /run/user/1000/kakoune"

Sorry about that! Although it would work with just the username, too,
since Kakoune would still be able to write into an owner-writable
directory.

>...of course, you can put your account's username and groupname
>directly instead of the "$(id -un):$(id -gn)" construct :)

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13


signature.asc
Description: PGP signature


Bug#990635: kakoune: Fatal error: unable to bind listen socket Permission denied

2021-07-03 Thread Peter Pentchev
Control: tag -1 confirmed upstream patch pending

On Sat, Jul 03, 2021 at 01:39:49PM +0200, xiscu wrote:
> Package: kakoune
> Version: 2020.01.16-2
> Severity: grave
> Justification: renders package unusable
> 
> Dear Maintainer,
> i'm currently unable to use kakoune as it gives a Permission denied error on 
> start
> (reinstalling the package hasn't solved the problem). The programm worked for 
> me,
> but currently i get:
> 
> Fatal error: unable to bind listen socket '/run/user/1000/kakoune/3781950': 
> Permission denied

Hi,

Yes, you did stumble into an upstream kakoune bug that is fixed in
a later upstream release that is not in Debian yet. The problem is that
Kakoune determines the name of a "user-specific directory to put some
stuff in" using your desktop environment's idea of a "user-specific
directory to put some stuff in", i.e. the XDG_RUNTIME_DIR environment
variable that is set upon the start of your GUI session. However, if you
*first* run `sudo kak something` (and you have told sudo to preserve
the environment variables!) or `su kak something` (and su, by default,
does preserve the environment variables), as the first thing you do
after restarting your computer, before running Kakoune as yourself,
then Kakoune will create its own directory while running as root, and
the directory will not be writable by your actual user account.
So if later you run it from your user account, it will not be able to
put stuff into that directory. This has happened with other tools, too,
and this is actually part of the reason why sudo does NOT preserve all
the environment variables by default. (Note: I'm not saying "don't use
su, use sudo!"; I'm just saying "su does some weird things by default,
sudo tries to prevent some problems by doing *other* weird things by
default, and it is not always the better choice, but it does help
prevent *some* problems")

I will test and adapt the patches for this problem, but in the meantime,
a short-term solution for your current situation is:

1. Make sure the problem is what I think it is:

   ls -ld /run/user/1000/kakoune

   ...and check that it is owned by "root", not by your user account

2. Change its owner to your user account:

   sudo chown "$(id -un):$(id -gn)" /run/user/1000/kakoune

   or, if using su:

   su -c "chown '$(id -un)' /run/user/1000/kakoune"

   ...of course, you can put your account's username and groupname
   directly instead of the "$(id -un):$(id -gn)" construct :)

That should fix it until the next time you restart your computer, since
Kakoune will see that the directory already exists and will not attempt
to recreate it. Even after you restart your computer, the problem will
only show up if you run Kakoune through su *before* running it from your
own user account.

...and I will indeed upload a bugfix version in the next couple of days.

Thanks for using Kakoune, and thanks for making its Debian package
better by reporting this problem!

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13


signature.asc
Description: PGP signature


Bug#990635: kakoune: Fatal error: unable to bind listen socket Permission denied

2021-07-03 Thread xiscu
Package: kakoune
Version: 2020.01.16-2
Severity: grave
Justification: renders package unusable

Dear Maintainer,
i'm currently unable to use kakoune as it gives a Permission denied error on 
start
(reinstalling the package hasn't solved the problem). The programm worked for 
me,
but currently i get:

Fatal error: unable to bind listen socket '/run/user/1000/kakoune/3781950': 
Permission denied

Thanks in advanve,
xiscu

-- System Information:
Debian Release: 11.0
  APT prefers testing
  APT policy: (900, 'testing'), (10, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-6-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages kakoune depends on:
ii  libc6 2.31-12
ii  libgcc-s1 10.2.1-6
ii  libncursesw6  6.2+20201114-2
ii  libstdc++610.2.1-6
ii  libtinfo6 6.2+20201114-2

kakoune recommends no packages.

kakoune suggests no packages.

-- no debconf information