Ticket #4612 (closed defect: duplicate)

Opened 2 weeks ago

Last modified 2 weeks ago

printwd option issue

Reported by: musinsky Owned by:
Priority: major Milestone:
Component: mc-core Version: 4.8.32
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

Fedora 41, package: mc-4.8.32-1.fc41.x86_64.rpm

$ ls create.file
ls: cannot access 'create.file': No such file or directory
$ /usr/bin/mc -P create.file   # non exist file
# exit from mc
$ cat create.file
/home/musinsky   # OK, contains last  working  directory

$ touch exist.file
$ /usr/bin/mc -P exist.file    # already existing file
# exit from mc
$ cat exist.file # file is empty !!!

As result this issue mc-wrapper.sh not working correctly (no last working directory after exit from mc).
Solution in my case (Fedora, bash): replace 'mktemp' by 'mktemp --dry-run'.

Change History

comment:1 Changed 2 weeks ago by andrew_b

mc-wrapper.sh and related stuff were changed in #4575.

mc-wrapper.sh itself creates a file which is used in -P option. If you don't want to use mc-wrapper you should understand what you do.

Apparently wontfix.

comment:2 Changed 2 weeks ago by musinsky

Sorry, my description was unclear.
I want to use mc-wrapper.sh, but due to mc -P issue doesn't work correctly.

if test -n "$MC_TMPDIR"; then
	MC_PWD_FILE="`mktemp "${MC_TMPDIR}/mc.pwd.XXXXXX"`"
elif test -n "$TMPDIR"; then
	MC_PWD_FILE="`mktemp "${TMPDIR}/mc.pwd.XXXXXX"`"
else
	MC_PWD_FILE="`mktemp "/tmp/mc.pwd.XXXXXX"`"
fi

/usr/bin/mc -P "$MC_PWD_FILE" "$@"
# @bindir@/mc -P "$MC_PWD_FILE" "$@"

# add this condition
if test -s "$MC_PWD_FILE"; then
	echo "$MC_PWD_FILE exists and has a size greater than zero, OK"
else
	echo "$MC_PWD_FILE is empty (or non exists), WRONG"
fi

if test -r "$MC_PWD_FILE"; then
	MC_PWD="`cat "$MC_PWD_FILE"`"
	if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then
		cd "$MC_PWD" || true
	fi
	unset MC_PWD
fi

rm -f "$MC_PWD_FILE"
unset MC_PWD_FILE
$ mc   # alias on mc-wrapper.sh
# exit from mc
/tmp/mc.pwd.b22kCx is empty (or non exists), WRONG
Last edited 2 weeks ago by musinsky (previous) (diff)

comment:3 in reply to: ↑ description Changed 2 weeks ago by andrew_b

Replying to musinsky:

Fedora 41, package: mc-4.8.32-1.fc41.x86_64.rpm

$ touch exist.file
$ /usr/bin/mc -P exist.file    # already existing file
# exit from mc
$ cat exist.file # file is empty !!!

My current working version is 4.8.32-124-g9182a8992.
File exist.file isn't empty. It contains a last working directory.
A new mc-wrapper from [e2d96fa802abebf888dcc2cc938cfd06abca8eb0] isn't enough. [d081bc68aa6ad3ded515ea490118b0a38a1ec204] is required too.

comment:4 Changed 2 weeks ago by musinsky

1st) I compiled mc from source (today master version) and all is OK

2nd) finally find problem in mc-4.8.32:

comment:5 Changed 2 weeks ago by zaytsev

  • Status changed from new to closed
  • Resolution set to duplicate
  • Milestone Future Releases deleted

Closed as duplicate of #4575 .
Yes, that's right. Will be out in the next release, or you need to back port from master.

Note: See TracTickets for help on using tickets.