Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
pressing Win+Z in Konsole dumps contents of /etc/hosts?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
KPF
n00b
n00b


Joined: 27 Oct 2019
Posts: 16

PostPosted: Sun Sep 29, 2024 12:55 pm    Post subject: pressing Win+Z in Konsole dumps contents of /etc/hosts? Reply with quote

1. start Konsole
2. press Win+Z
3. have /etc/hosts dumped to screen
4. have 'sz' entered in command line

For example
Quote:

username@hostname:~$
::1 ff02::1 ip6-allnodes ip6-localnet localhost
e00::0 ff02::2 ip6-allrouters ip6-loopback hostname
username@hostname:~$ sz


But there are no Win+Z or Meta+Z in keyboard shortcuts of System settings, or Konsole shortcuts.

(a) main Gentoo box, Plasma 6 session, its own Konsole.

(b) SSH to the second Gentoo box or Ubuntu box from the same main Gentoo box started in Konsole

(c) check in text console (TTY1 etc) ? impossible, as pressing Win switches to another TTY.
Xterm also does not show this behaviour. So it is Konsole.

What is this feature? How to change it?

Are there tons of users who demanded such nontrivial functionality? (Maybe I could use it too, for dumping some another file...)
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3399
Location: Canada

PostPosted: Sun Sep 29, 2024 5:53 pm    Post subject: Reply with quote

Same here, indeed, though it is not literally /etc/hosts in my case.

It gives only

::1 grizzly localhost

(grizzly is my machine), not IPV4 assignments, and there is no literally this line /etc/hosts. What I have there is

::1 localhost

So it looks like it dumps some network information
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1663
Location: Germany

PostPosted: Mon Sep 30, 2024 5:50 am    Post subject: Reply with quote

Any change or missconfig in keyboard shortcuts? Or maybe a reset of them could help?
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3399
Location: Canada

PostPosted: Mon Sep 30, 2024 3:13 pm    Post subject: Reply with quote

Banana wrote:
Any change or missconfig in keyboard shortcuts? Or maybe a reset of them could help?


In my case I never touched keyboard shortcuts configuration. At least not that I remember.
Back to top
View user's profile Send private message
42n4
n00b
n00b


Joined: 10 Feb 2015
Posts: 20

PostPosted: Wed Oct 02, 2024 7:58 am    Post subject: Reply with quote

Meta+n (Win+n) gives the same result, but with sn on the command line.
I also tried to find Alt-o in konsole (interacts with mc), but failed.
In ~/.config/khotkeysrc I have found many strange shortcuts and ~/.config/kwinrc contains strange stuff, too.
But Win+n, Win+z, Alt+o remained not found.
_________________
OS: Gentoo 2.15 gcc13/14/15
Kernel: Linux 6.10.10-zen1
KDE Plasma 6.1.5
WM: NVIDIA 4060/AMD Wayland
http://bit.ly/gen2ls
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2131

PostPosted: Wed Oct 02, 2024 10:59 am    Post subject: Reply with quote

I too get a network printout for Win+Z, or rather:
Code:
paul@hp ~ $
::1        hp         localhost 
paul@hp ~ $ sz
Note the input "sz" comes as part of the output, so I guess that's the "+Z" and the network line is from the "Win" key.
The output is not my /etc/hosts - that has a line for IPV4 127.0.0.1 as well as the IPV6 ::1 entry above, and a load of comments.

FWIW I've never knowingly set any keyboard shortcuts.

Dunno if that helps.
_________________
Greybeard
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 588

PostPosted: Wed Oct 02, 2024 1:40 pm    Post subject: Reply with quote

In Konsole, I get the network info printed on Win+{z,x,c,v,*}, but the line has to be blank, if you leave the "sz" after the first combo, nothing else works. It seems to be the default behaviour for an unbound Win+[something] combo.

The network info is *from* /etc/hosts, but is seems to be some kind of ad-hoc workaround for missing ipv6 entries (my /etc/hosts has some temp ipv4 stuff in there from a set-up I built for a friend, 'cos I couldn't be bothered to make a zone file for in BIND) - it seems to be redirecting known ipv4 hosts without an ipv6 entry to ::1...
Back to top
View user's profile Send private message
Zarhan
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1009

PostPosted: Thu Oct 03, 2024 7:36 am    Post subject: Reply with quote

This seems to be limited *only* to Konsole.

xev doesn't register anything special either.

Code:
KeyPress event, serial 40, synthetic NO, window 0x4000001,
    root 0x478, subw 0x0, time 185913327, (58,110), root:(1605,140),
    state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x4000001,
    root 0x478, subw 0x0, time 185914624, (58,110), root:(1605,140),
    state 0x40, keycode 52 (keysym 0x7a, z), same_screen YES,
    XLookupString gives 1 bytes: (7a) "z"
    XmbLookupString gives 1 bytes: (7a) "z"
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4000001,
    root 0x478, subw 0x0, time 185914814, (58,110), root:(1605,140),
    state 0x40, keycode 52 (keysym 0x7a, z), same_screen YES,
    XLookupString gives 1 bytes: (7a) "z"
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x4000001,
    root 0x478, subw 0x0, time 185915090, (58,110), root:(1605,140),
    state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Back to top
View user's profile Send private message
steve_v
Guru
Guru


Joined: 20 Jun 2004
Posts: 406
Location: New Zealand

PostPosted: Thu Oct 03, 2024 8:00 am    Post subject: Reply with quote

Apparently this is coming from the "ssh plugin", but I'll be dammned if I can find any documentation or configuration for it.
_________________
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2697
Location: Here and Away Again

PostPosted: Thu Oct 03, 2024 12:02 pm    Post subject: Reply with quote

I have no idea what the references "ssh plugin" might be, but I have noticed this host print thing happen with QTerminal as well.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 588

PostPosted: Thu Oct 03, 2024 12:19 pm    Post subject: Reply with quote

steve_v wrote:
Apparently this is coming from the "ssh plugin"

It's not, I just built Konsole without the ssh manager plugin and it's still doing it. Maybe it's coming from the plugin manager code, but not that specific plugin.

I'm not a total noob when it comes to CMake, but not far off, so I'll drop this:
diff -ur /var/db/repos/gentoo/kde-apps/konsole/konsole-24.05.2-r1.ebuild /var/db/repos/local/kde-apps/konsole/konsole-24.05.2-r2.ebuild:
@@ -52,6 +52,7 @@
 src_configure() {
        local mycmakeargs=(
                -DWITH_X11=$(usex X)
+               -DENABLE_PLUGIN_SSHMANAGER=0
        )
        ecm_src_configure
 }
ENABLE_PLUGIN_SSHMANAGER seems to be the CMake switch to include it's source directory, and after flipping it the "SSH plugin" is gone from the plugin menu, the aberrant win+[undefined] behaviour however is not.

If someone could check this I'd be very grateful.

EDIT: Just built with -DENABLE_PLUGIN_QUICKCOMMANDS=0 too, same behaviour.
Further EDIT:
Chiitoo wrote:
I have noticed this host print thing happen with QTerminal as well.
Damn, I wish I'd read this before messing around with ebuilds. Confirming same behaviour in QTerminal. It's also not a "plasma thing", tested in dwm. There is either "similar code" in Konsole and QTerminal or it's an underlying QT problem.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3399
Location: Canada

PostPosted: Fri Oct 04, 2024 12:41 am    Post subject: Reply with quote

BTW, regarding that repot, which says it dumps host mapped to 127.0.0.1. On my machine it is not, it dumps all hosts defined in /etc/hosts, + ::1 symbol.
On my other machine, Win-Z gives

Code:

polarbear ~ # (Win-Z here)
::1              basilisk.local   homenet          pardus.local     polarbear       
NPIDD1ECF.local  grizzly          localhost        pizzly           polarbear.local 
basilisk         grizzly.local    pardus           pizzly.local     
sz

while my /etc/hosts has
Code:

# IPv4 and IPv6 localhost aliases
127.0.0.1       localhost
192.168.1.10    polarbear.local polarbear
192.168.1.11    basilisk basilisk.local
192.168.1.110   pardus.local
192.168.1.12    pizzly.local pizzly
192.168.1.13    pardus
192.168.1.14    grizzly
192.168.1.114   grizzly.local
192.168.1.20    NPIDD1ECF.local
192.168.1.0     homenet
::1             localhost


seems like all are present in the dump
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22474

PostPosted: Fri Oct 04, 2024 1:06 am    Post subject: Reply with quote

This sounds like the readline binding for complete-hostname or perhaps possible-hostname-completions is being triggered. The stated default values for those bindings are not consistent with the key sequences reported here, but there is no guarantee that the reported key (Win+Z etc.) is not generating a sequence of keys that contain the triggering key sequence.

For someone who sees this happen, what do you get if you run xxd, then type the key sequence, and an EOF? That will tell us what characters the terminal is sending to the contained program.
Back to top
View user's profile Send private message
KPF
n00b
n00b


Joined: 27 Oct 2019
Posts: 16

PostPosted: Fri Oct 04, 2024 4:36 am    Post subject: Reply with quote

Aha!
yes, it looks like completion for host names.

Pressing Win+Z after typing 'lo' gives 'localhost' only, from all entries before.

Similarly for other entries.

Quote:

$ ping lo
localhost
$ ping losz
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2131

PostPosted: Fri Oct 04, 2024 10:53 am    Post subject: Reply with quote

Hmm. I noticed I'd accumulated a couple of non-default konsole profiles for no reason I could remember, so I deleted them and made the Built-in profile default. Now Win+W gives the "select a Window" display (zoom out and display the running application windows). No hint of any networking stuff ... I'm disappointed, I was enjoying exploring this rabbit hole!
_________________
Greybeard
Back to top
View user's profile Send private message
KPF
n00b
n00b


Joined: 27 Oct 2019
Posts: 16

PostPosted: Fri Oct 04, 2024 12:57 pm    Post subject: Reply with quote

I switched the Konsole profile to Default, still the same network info is printed. Not at Win+W, but Win+Z and Win+n...

Moreover, Konsole with SSH opened to another machine, prints the network info from that machine.

Some kernel mumbo-jumbo, it seems.

This behaviour is not new, it was there in Plasma 5, at least year ago, I just was lazy to ask...

But I mean, I would not want to have discovered some many-years old worm like recent xz backdoor. Reacting to invisible keypresses from another worm.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22474

PostPosted: Fri Oct 04, 2024 1:10 pm    Post subject: Reply with quote

KPF: I asked above for information that might let us understand it. Are you able to collect that? Why do you think this is a kernel problem?
Back to top
View user's profile Send private message
steve_v
Guru
Guru


Joined: 20 Jun 2004
Posts: 406
Location: New Zealand

PostPosted: Fri Oct 04, 2024 2:26 pm    Post subject: Reply with quote

Hu wrote:
what do you get if you run xxd, then type the key sequence

Code:
^X@sz

_________________
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
Back to top
View user's profile Send private message
KPF
n00b
n00b


Joined: 27 Oct 2019
Posts: 16

PostPosted: Fri Oct 04, 2024 2:28 pm    Post subject: Reply with quote

Hu: sorry, I don't have xxd installed, but there are two in portage, which is right? (dev-util/xxd or dev-util/xxdi - emerging both, I will install and try them. Though never used xxd so collecting the requested information will need some time.

About kernel problem, it was simply my panic :) lack of information. sorry if it sounded rude...
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 414

PostPosted: Fri Oct 04, 2024 2:35 pm    Post subject: Reply with quote

Hu wrote:
What do you get if you run xxd, then type the key sequence, and an EOF? That will tell us what characters the terminal is sending to the contained program.

I am assuming that by EOF you mean CTRL+D? If so:
Code:

xxd
^X@sz00000000: 1840 737a                                .@sz
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22474

PostPosted: Fri Oct 04, 2024 3:17 pm    Post subject: Reply with quote

Yes, Ctrl+D is the traditional way to generate EOF.

For tools, hexdump or od -tx would also work, but this is fine. That confirms the problem. When you type this key sequence, the terminal sends to the contained program the four characters: ^X (control X), an at sign, 's', and 'z'. The first two of those are the readline default for possible-hostname-completions:
info bash:
'possible-hostname-completions (C-x @)'
     List the possible completions of the text before point, treating it
     as a hostname.
That explains the output, and since it is List, rather than Attempt, the shell never inserts a hostname, even if your prefix is unambiguous. The latter two, s and z, have no special meaning to readline and are inserted as literal characters.

Putting all this together, we understand why you get that output, and why it happens even when logged in to a remote machine. The next question is why typing this key sequence produces those characters instead of something more useful. The answer will be some combination of your terminal emulator, your display server, and possibly even the keyboard driver. I cannot guide you to find that answer. I will note that Goverp seems to have at least partially alleviated this problem by resetting to the default Konsole profile. I will continue watching the thread, but at this point I have no further questions, and no suggestions for how to proceed.
Back to top
View user's profile Send private message
KPF
n00b
n00b


Joined: 27 Oct 2019
Posts: 16

PostPosted: Fri Oct 04, 2024 5:13 pm    Post subject: Reply with quote

So this is the bash command, now I understand!

UPD: I probably found the cause (from this question from Feb 2021 to the explanation)

Quote:
It's Konsole-specific feature introduced in commit 5ba34471 back in 2012


Quote:
It's hard-coded (not configurable) and done intentionally. The git log for that commit says


Quote:
Translate the "Super" modifier into bytes prefix understood by Emacs.
Note: although it is Qt::MetaModifier in the code, the actual pressed
key is the "Super/Windows" key.


and one comment from 2023 asks to make this configurable.

Se we can relax and wait... :)

Thanks everybody! Sorry for the riddle!
Back to top
View user's profile Send private message
rab0171610
Guru
Guru


Joined: 24 Dec 2022
Posts: 414

PostPosted: Fri Oct 04, 2024 5:22 pm    Post subject: Reply with quote

How very curious. I learn something new every day. Thank you for solving the mystery!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum