Red Hat Bugzilla – Bug 103902
Going to non-existent directory when selecting files puts minicom into inconstistent state
Last modified: 2007-04-18 12:57:25 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312
Description of problem:
When you select a file for upload (CTRL+A - S) you are given a choice of
protocols. After you select a protocol, you are given a file selction dialog.
One of the options in the file selection dialog is "Goto", which allows you to
select a directory.
If you type in a directory that doesn't exist (for example, if you mistype a
directory that does exist), minicom gets into a bad state where it thinks its in
the non-existent directory. It will put the non-existent directory in the
"Directory" field and any attempt to walk the directory structure will using the
arrows and space will fail.
You can get minicom back into a good state by changing to a valid directory with
the "Goto" option.
The cause of the bug is file.c:new_filedir() does not check the return value of
chdir. Likewise, the functions that call new_filedir() set the work_dir global
variable before calling new_fildir, do not check for errors, and do not restore
the old working directory on error.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.CTRL+A - S (for sending files)
3.Press G (for goto dialog box)
4.Enter a nonexistent directory, like "/nonexistentdir"
Actual Results: The working directory changes to the "/nonexistentdir"
Expected Results: An error message tells you that "/nonexistentdir" does not
exist, and the working directory does not change.
Created attachment 94281 [details]
patch to handle going to a non-existent directory gracefully
This patch checks the return value of chdir and, if non-zero does restors
work_dir to the current working directory. This patch is careful not to change
the contents of prev_dir when chdir fails.
thanks again for the patch. are these fixes in minicom 2.1?