[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Patch for bug #44950
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] Patch for bug #44950 |
Date: |
Fri, 15 Jan 2016 21:44:20 +0100 |
Hello Rishabh,
On Fri, Jan 15, 2016, at 19:56, Rishabh Dave wrote:
> I am sending this unfinished patch because I think I solved that "lockfile
> business" stuff. And I think it would be most of work except for few minor
> issues. If this works for lockfile, I will send another patch sincerely
> finished.
Okay.
> On doing './nano -G nonexistent-dir/some-file' nano used to report on
> statusbar "Error writing lock file: Directory 'nonesxistent-dir' doesn't
> exist" and later (in last patch) it used to skip that message and report
> while providing an input "Warning: Modifying a file which is not locked,
> check directory permission?"
>
> This time it only says "Directory nonexistent-dir doesn't exist" and one
> could save safely and normally. So, I guess case solved?
Yes, your current behaves well.
(Except for the precise message; see below.)
> Some questions -
>
> If './nano a/b/c/d/e' is done where 'a' is only existent directory and 'e'
> is regular file then what should nano print "Directory b doesn't exist" or
> "Directory b/c/d/ doesn't exist" or something else?
It should say "Directory a/b/c/d does not exist". It should simply
report the entire path the user specified *minus* the last component
(which logically would be a regular file, but since its preceding
component doesn't exist, or isn't a directory, it is nothing).
> I am afraid I may be
> missing some point because initially I printed latter and you asked me for
> former and we are on latter again, I guess.
Yes. Sorry. I changed my mind. I wanted nano to be too smart.
> Is it okay to get rid of faulty_path variable (global or in struct) and
> call fault_in_path() whenever required.
Yes.
> Total count of calling fault_in_path()
> would be thrice per filename irrespectively.
Hmm. But that would mean that the parent dir of the
target file would be statted three times. Not nice.
I would suggest two static variables in fault_in_path():
char *last_filename and bool last_result. If the passed
filename equals last_filename, you return last_result.
If not, you copy the given filename to last_filename,
do your statting, copy the result to last_result, and if
the result is FALSE, you beep and show the message,
and then return last_result.
Benno
--
http://www.fastmail.com - The way an email service should be
- Re: [Nano-devel] Patch for bug #44950, (continued)
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/03
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/05
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/06
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/09
- Re: [Nano-devel] Patch for bug #44950, Mike Frysinger, 2016/01/09
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/10
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/11
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/11
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/12
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/15
- Re: [Nano-devel] Patch for bug #44950,
Benno Schulenberg <=
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/15
- Re: [Nano-devel] Patch for bug #44950, Mike Frysinger, 2016/01/15
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/17
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/17
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/17
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/17
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/17
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/18
- Re: [Nano-devel] Patch for bug #44950, Rishabh Dave, 2016/01/18
- Re: [Nano-devel] Patch for bug #44950, Benno Schulenberg, 2016/01/19