Re: Patch recommendation for replace invoke of error() to that of error_errno()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 05, 2018 at 11:24:02AM +0800, 牛旭 wrote:

> Our team researches on consistent update of Git during evolution. And
> we have figured out several spots that may be missed. 
> 
> 
> By mining historical patches, we suggest that invokes of error(...,
> strerror(errno)) should be replaced with that of error_errno(). One
> example for recommendation and corresponding patch are listed as
> follows. 

Yes, historically we've done cleanups like this across time as we touch
the various pieces of code. More conversions are welcome as long as they
don't conflict with any topics that other people are working on (a good
test is to see if your suggested changes merge cleanly with the "pu"
branch).

In more recent times, we've been using the Coccinelle tool to do
automated conversions across the code base. Look at the contents and
history of the contrib/coccinelle directory. This might be a candidate
for that cleanup.

> One example of missed spot:
> 
> 1  int cmd_fetch__tool(int argc, const char **argv, const char 
>   *prefix)
> 2  {
> ....
> 31  filename = git_path_fetch_head();
> 32  fp = fopen(filename, "a");
> 33  if (!fp)
> 34  return error("cannot open %s: %s", filename, strerror(errno));
> ....
>   }

This one is actually a bit funny. It's in contrib/examples, which is all
historical code. It's not compiled or used as part of Git (and I'd
suspect most of it would not compile at all these days). It's not really
worth modernizing.

> More recommendations and supporting patches are saved in attachments.
> It is so kind of you to reply me about the correctness of our
> suggestions. And thank you for your reading. 

Eek, word documents. We're happy to take patches, but please format them
as plain text in your email (e.g., by using git-send-email). More
details are in Documentation/SubmittingPatches. Thanks.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux