git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix merge-recursive on cygwin: broken errno when unlinking a directory

From
Alex Riesen <raa.lkml@gmail.com>
Date
Apr 18, 2007, 23:40 UTC
Message-ID
<20070418234034.GE2477@steel.home>
In-Reply-To
<alpine.LFD.0.98.0704181537590.9964@woody.linux-foundation.org>
Linus Torvalds, Thu, Apr 19, 2007 01:04:06 +0200:
Show 8 quoted lines
> >
> > +				struct stat st;
> > +				int err = errno;
> > +				if (err == EISDIR ||
> > +				    (err == EPERM && !lstat(path, &st) && S_ISDIR(st.st_mode))) {
> 
> Can I ask people to please *not* write things like this?
> 
Err... ok.
> 
> (Side note: EPERM is actually apparently the POSIXLY correct error!)
> 
Indeed it is 8-[]
Show 6 quoted lines
> 
> So here's a suggested and totally untested patch. It makes the code more 
> readable, and probably fixes *two* bugs in the process. It also simply 
> doesn't really even care what the error actually was - the important part 
> was not that it was a directory, but that the unlink didn't succeed!
>

Well, it is a bit tested now. I'll repeat the testing tomorrow on that windows box.

> +	/* .. but not some other error (who really cares what?) */
> +	return error(msg, path, ": perhaps a D/F conflict?");

I have to care sometimes when cygwin breaks where you never expect it to. These annoying strerror(errno)'s a very helpful. IOW, how can the user respond to the message which just tells "maybe it is expected and you can fix it. Perhaps"? What do I do here next? (well, I know what to do, but someone wont).

An lstat + S_ISDIR would at least make it plain "D/F conflict".
Previous: Linus TorvaldsNext: Alex Riesen
Message 3 of 6 in “Fix merge-recursive on cygwin: broken errno when unlinking a directory”
  1. Fix merge-recursive on cygwin: broken errno when unlinking a directoryAlex Riesen, Apr 18, 2007
  2. Linus TorvaldsApr 18, 2007
  3. Alex RiesenApr 18, 2007
  4. Alex RiesenApr 19, 2007
  5. Linus TorvaldsApr 19, 2007
  6. Sam RavnborgApr 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.