Project

General

Profile

Bug #6741

/etc/rc.initial does not trap CTRL-C back to console menu but rather to # prompt.

Added by Dan Lundqvist 7 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Low
Category:
Console Menu
Target version:
Start date:
08/25/2016
Due date:
% Done:

100%

Affected version:
2.3.2
Affected Architecture:
All

Description

I found a problem with trap mechanism in /etc/rc.initial that does not trap CTRL-C back to ssh/cli console menu.
Instead it ends up in # prompt. If I then do exit, it goes back to menu as it should.

I could see that the existing /etc/rc.initial has the trap 2 , 3 and 4 commented.

# make sure the user can't kill us by pressing Ctrl-C,
# ctrl-z, etc.
#trap : 2
#trap : 3
@#trap : 4

I tried to uncomment "trap 2" (which is CTRL-C) and then it worked as it should. Whenever I do CTRL-C it always return to the ssh/cli console menu.

I also had a look in the repository for the /etc/rc.initial and found a commit:
Scott Ullrich committed on 2 Mar 2007
ctrl-c is handy in the shell. Do not lock out.
RELENG_1_2_RELEASE

-trap : 2
-trap : 3
-trap : 4
+#trap : 2
+#trap : 3
+#trap : 4

and

Scott Ullrich committed on 19 Jun 2005
Misc comments
RELENG_1_2_RELEASE

-# make sure the user can't kill us by pressing Ctrl-C
+# make sure the user can't kill us by pressing Ctrl-C,
+# ctrl-z, etc.

However, I think this is not entirely true as what I found when testing was that with "trap 2" enabled
the CTRL-C does work but the difference is that you will get back to console menu instead of # prompt.

As console menu has a menu "8 Shell" it is possible to get to pure shell even from console menu
so the CTRL-C inside functions like "Filter Logs" will let the user get back to console menu instead of # prompt.

I am not sure though if the "trap 2" will break anything if executed from non Serial / Ssh console.

Best regards
Dan Lundqvist
Stockholm, Sweden

Associated revisions

Revision 533f3160
Added by Renato Botelho 3 months ago

Revert "ctrl-c is handy in the shell. Do not lock out."

This doesn't seem to be a problem these days. Fixes #6741

This reverts commit e8b82b8191356d50a2f210067d7a9f32976d4075.

Revision 0ecbaa0e
Added by Renato Botelho 3 months ago

Revert "ctrl-c is handy in the shell. Do not lock out."

This doesn't seem to be a problem these days. Fixes #6741

This reverts commit e8b82b8191356d50a2f210067d7a9f32976d4075.

History

#1 Updated by Jim Pingle 6 months ago

  • Target version changed from 2.3.2_1 to 2.4.0

#2 Updated by Renato Botelho 4 months ago

  • Assignee set to Renato Botelho

#3 Updated by Renato Botelho 3 months ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#4 Updated by Jim Pingle 3 months ago

  • Status changed from Feedback to Resolved

Works well. I went into several console menu options and confirmed ^C returned to the menu from all of them rather than generating a shell prompt. From inside a shell prompt (option 8), ^C still worked as usual when working interactively as expected.

#5 Updated by Jim Pingle about 2 months ago

  • Target version changed from 2.4.0 to 2.3.3

Also available in: Atom PDF