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
NNNLVL increments on every shell invocation (macOS) #639
Comments
Can you please print
https://github.com/jarun/nnn/wiki/Developer-guides#debugging-nnn |
With this change: diff --git a/src/nnn.c b/src/nnn.c
index e822a4c..514d7eb 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -6377,6 +6377,7 @@ nochange:
case SEL_SHELL:
/* Set nnn nesting level */
tmp = getenv(env_cfg[NNNLVL]);
+ DPRINTF_S(tmp);
setenv(env_cfg[NNNLVL], xitoa((tmp ? atoi(tmp) : 0) + 1), 1);
setenv(envs[ENV_NCUR], (ndents ? dents[cur].name : ""), 1); I got the following log by starting nnn
|
Can you print
and
Let's figure where |
With these changes: diff --git a/src/nnn.c b/src/nnn.c
index e822a4c..9e22f57 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -6377,11 +6377,14 @@ nochange:
case SEL_SHELL:
/* Set nnn nesting level */
tmp = getenv(env_cfg[NNNLVL]);
+ DPRINTF_S(tmp);
setenv(env_cfg[NNNLVL], xitoa((tmp ? atoi(tmp) : 0) + 1), 1);
+ DPRINTF_S(tmp);
setenv(envs[ENV_NCUR], (ndents ? dents[cur].name : ""), 1);
spawn(shell, NULL, NULL, F_CLI);
setenv(env_cfg[NNNLVL], xitoa(tmp ? atoi(tmp) : 0), 1);
+ DPRINTF_S(tmp);
r = TRUE;
break;
case SEL_LAUNCH: I get the following log:
The first pass seems fine. We get I can imagine that the memory for which |
|
Please confirm if the following patch works. |
@jarun It works! I've tested it on both macOS and Arch Linux. Thank you! |
Awesome! |
[x] Operating System: macOS Mojave 10.14.6
[x] Terminal Emulator: iTerm2 (v3.3.10)
[x] Shell: either fish (v3.1.2) or bash (v5.0.17)
[x] Issue exists on
nnn
master (reproduced 65cf067)Exact steps to reproduce the issue
Same as in #510. Works fine on my Arch box (LTS kernel v5.4.44, Fish v3.1.2), but on macOS
NNLVL
still increases as reported in that issue.I was able fix it by doing the following change:
But in Arch it will wraparound. I could put it in a
__APPLE__
guard but doesn't seem a good idea because I still don't know what the underlying problem is.Thank you for any attention you could give to this.
The text was updated successfully, but these errors were encountered: