[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount closed https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: I don't know what you're talking about. I know however that you're bikeshedding. Sad. https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Owen Pan via cfe-commits
owenca wrote: > > Diagnostic output should go to stderr, but the informational output of > > git-clang-format is sent to stdout instead. > > What does that mean? The printing of null-terminated paths on stdout is > pretty standard on unix utilities. What's "diagnostic" and "informational"? Di

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: > Diagnostic output should go to stderr, but the informational output of > git-clang-format is sent to stdout instead. What does that mean? The printing of null-terminated paths on stdout is pretty standard on unix utilities. What's "diagnostic" and "information

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-09 Thread Owen Pan via cfe-commits
owenca wrote: > > It seems that `git-clang-format` was not designed for its output to be > > consumed by another utility as it prints everything to `stdout` instead of > > `stderr`. Adding an option like`--print0` (especially just for `--staged`) > > looks odd to me. > > No, the approach of p

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-08 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: @owenca ping https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-08 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -260,15 +265,13 @@ def main(): "Ignoring the following files (wrong extension, symlink, or " "ignored by clang-format):" ) -for filename in ignored_files: -print("%s" % filename) +print_f

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: > > > From #123921, it seems that you only want the new option to work with > > > `--staged`, but should it also work with other options that may print a > > > list of filenames? > > > > > > I don't know; I only use `git clang-format` as in #123921 and I am no

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Owen Pan via cfe-commits
owenca wrote: > > From #123921, it seems that you only want the new option to work with > > `--staged`, but should it also work with other options that may print a > > list of filenames? > > I don't know; I only use `git clang-format` as in #123921 and I am not > familiar with all its uses. I

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount edited https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -260,15 +265,13 @@ def main(): "Ignoring the following files (wrong extension, symlink, or " "ignored by clang-format):" ) -for filename in ignored_files: -print("%s" % filename) +print_f

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-02 Thread Björn Schäpers via cfe-commits
@@ -260,15 +265,13 @@ def main(): "Ignoring the following files (wrong extension, symlink, or " "ignored by clang-format):" ) -for filename in ignored_files: -print("%s" % filename) +print_f

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-02-01 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: @owenca @mydeveloperday @HazardyKnusperkeks I'll ping now that it's the weekend, perhaps you have some time to look at this more; in particular now I got the `--null` option to work for `--staged`, but I'm not sure how you'd like it to work for other options. I

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): createyourpersonalaccount wrote: I removed the default value of the argument in c47ce3ca8946f81f39757c82bfa5eb4cddc863a5. https

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount updated https://github.com/llvm/llvm-project/pull/123926 >From 9dfbb9a3cc7f6bc557bc1ccf25cc727a02c4274c Mon Sep 17 00:00:00 2001 From: Nikolaos Chatzikonstantinou Date: Wed, 22 Jan 2025 05:43:02 -0500 Subject: [PATCH 1/8] [clang-format] Add null-term

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", +action="store_true", +help="print the affected paths with null-terminated characters", createyourpersonalaccount wrot

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", createyourpersonalaccount wrote: Done in e2ecb4bfc9dc8d43d7020d0d7476e86a6a29cadf, 9bd8510d2e4739dbb0347694c84360820a5343b1. https:

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -261,14 +267,14 @@ def main(): "ignored by clang-format):" ) for filename in ignored_files: -print("%s" % filename) +print_filename(filename, opts.null) createyourpersonalaccount wro

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount updated https://github.com/llvm/llvm-project/pull/123926 >From 9dfbb9a3cc7f6bc557bc1ccf25cc727a02c4274c Mon Sep 17 00:00:00 2001 From: Nikolaos Chatzikonstantinou Date: Wed, 22 Jan 2025 05:43:02 -0500 Subject: [PATCH 1/7] [clang-format] Add null-term

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount updated https://github.com/llvm/llvm-project/pull/123926 >From 9dfbb9a3cc7f6bc557bc1ccf25cc727a02c4274c Mon Sep 17 00:00:00 2001 From: Nikolaos Chatzikonstantinou Date: Wed, 22 Jan 2025 05:43:02 -0500 Subject: [PATCH 1/4] [clang-format] Add null-term

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount updated https://github.com/llvm/llvm-project/pull/123926 >From 9dfbb9a3cc7f6bc557bc1ccf25cc727a02c4274c Mon Sep 17 00:00:00 2001 From: Nikolaos Chatzikonstantinou Date: Wed, 22 Jan 2025 05:43:02 -0500 Subject: [PATCH 1/3] [clang-format] Add null-term

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: > From #123921, it seems that you only want the new option to work with > `--staged`, but should it also work with other options that may print a list > of filenames? I don't know; I only use `git clang-format` as in #123921 and I am not familiar with all its

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", owenca wrote: Please move it (and `--diff_from_common_commit` above) up to keep the options sorted. I would use `--print0` (without

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", +action="store_true", +help="print the affected paths with null-terminated characters", owenca wrote: ```suggestion

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): +if null: +print(filename + "\0", end="") owenca wrote: > Shouldn't you copy the the indentation of the printed files

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
@@ -261,14 +267,14 @@ def main(): "ignored by clang-format):" ) for filename in ignored_files: -print("%s" % filename) +print_filename(filename, opts.null) owenca wrote: ```suggestion

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
@@ -869,5 +876,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): +if null: +print(filename + "\0", end="") +else: +print("%s" % filename) owenca wrote: ```suggestion

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
owenca wrote: >From #123921, it seems that you only want the new option to work with >`--staged`, but should it also work with other options that may print a list >of filenames? https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-26 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread Björn Schäpers via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", +action="store_true", +help="print the affected paths with null-terminated characters", HazardyKnusperkeks wrote: I t

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount updated https://github.com/llvm/llvm-project/pull/123926 >From 9dfbb9a3cc7f6bc557bc1ccf25cc727a02c4274c Mon Sep 17 00:00:00 2001 From: Nikolaos Chatzikonstantinou Date: Wed, 22 Jan 2025 05:43:02 -0500 Subject: [PATCH 1/2] [clang-format] Add null-term

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", +action="store_true", +help="print the affected paths with null-terminated characters", createyourpersonalaccount wrot

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread via cfe-commits
https://github.com/mydeveloperday edited https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread via cfe-commits
@@ -205,6 +205,12 @@ def main(): "commits" ), ) +p.add_argument( +"-0", +"--null", +action="store_true", +help="print the affected paths with null-terminated characters", mydeveloperday wrote: if you

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread via cfe-commits
https://github.com/mydeveloperday requested changes to this pull request. on reflection, I think better named arguments might be better https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-24 Thread via cfe-commits
mydeveloperday wrote: > > This seems reasonable to me, but wait for the others, maybe @owenca > > I'm wondering if `-0` should turn off all informational messaging as well and > _only_ print the paths. As it is, it will print things like _Running > clang-format on the following files:_, even i

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-23 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: > > > This seems reasonable to me, but wait for the others, maybe @owenca > > > > > > I'm wondering if `-0` should turn off all informational messaging as well > > and _only_ print the paths. As it is, it will print things like _Running > > clang-format on the

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-23 Thread Björn Schäpers via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): HazardyKnusperkeks wrote: If this were C++ I'd say yes, you touched all calls (since you added it). Don't know if in Python it i

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-23 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: > > This seems reasonable to me, but wait for the others, maybe @owenca > > I'm wondering if `-0` should turn off all informational messaging as well and > _only_ print the paths. As it is, it will print things like _Running > clang-format on the following files:_, ev

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-23 Thread Nikolaos Chatzikonstantinou via cfe-commits
createyourpersonalaccount wrote: > This seems reasonable to me, but wait for the others, maybe @owenca I'm wondering if `-0` should turn off all informational messaging as well and *only* print the paths. As it is, it will print things like _Running clang-format on the following files:_, even

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-23 Thread via cfe-commits
https://github.com/mydeveloperday approved this pull request. This seems reasonable to me, but wait for the others, maybe @owenca https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-23 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount edited https://github.com/llvm/llvm-project/pull/123926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): createyourpersonalaccount wrote: I think that was a reflex, I set it to `False`, which is what `opts.null` is by default. Do you

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread Nikolaos Chatzikonstantinou via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): +if null: +print(filename + "\0", end="") createyourpersonalaccount wrote: I don't think so, because indentation is m

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread Björn Schäpers via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): HazardyKnusperkeks wrote: Why setting a value for null? https://github.com/llvm/llvm-project/pull/123926 ___

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread Björn Schäpers via cfe-commits
@@ -869,5 +875,12 @@ def convert_string(bytes_input): return str(bytes_input) +def print_filename(filename, null=False): +if null: +print(filename + "\0", end="") HazardyKnusperkeks wrote: Shouldn't you copy the the indentation of the pri

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Nikolaos Chatzikonstantinou (createyourpersonalaccount) Changes This makes the `git clang-format` tool compose nicely with other shell utilities in case of maliciously (or innocently) crafted filenames. --- Full diff: https://githu

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread via cfe-commits
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it

[clang] [clang-format] Add null-terminated path option (#123921) (PR #123926)

2025-01-22 Thread Nikolaos Chatzikonstantinou via cfe-commits
https://github.com/createyourpersonalaccount created https://github.com/llvm/llvm-project/pull/123926 This makes the `git clang-format` tool compose nicely with other shell utilities in case of maliciously (or innocently) crafted filenames. >From 9dfbb9a3cc7f6bc557bc1ccf25cc727a02c4274c Mon Se