Re: [PATCH] grep: follow conventions for printing paths w/ unusual chars

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

 



Matheus Tavares <matheus.bernardino@xxxxxx> writes:

> +	if (opt->relative && opt->prefix_length)
> +		quote_path_relative(filename + tree_name_len, opt->prefix, out);
> +	else
> +		quote_c_style(filename + tree_name_len, out, NULL, 0);

Yup.  This solves the discrepancy reported correctly (i.e. both
sides should do the quoting, the original only quoted when relative,
and the new code corrects the other side).

> +	if (tree_name_len)
> +		strbuf_insert(out, 0, filename, tree_name_len);

I am not quite sure about this part, though.  

Earlier we inserted the latter part of filename (after offset
tree_name_len) to strbuf "out" after quoting, and then we are
prefixing the earlier part of the filename without quoting to that
same "out".  Wouldn't a path ABCDEF (I do not literally mean that
these ascii alphabets need quoting---just imagine each of these
stands for a different letter and some causes the path to be quoted)
with tree_name_len pointing somewhere in the middle be added as (an
analog of) ABC"DEF", i.e. literal prefix with remainder quoted?  I
would (perhaps näively) expect that the whole thing would be placed
inside a dq pair in such a case, even if the prefix part alone would
not require quoting.

Thanks.






[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