Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.github/ISSUE_TEMPLATE: add a required "target" field to bug.yml #11738

Closed
perillo opened this issue May 27, 2022 · 5 comments
Closed

.github/ISSUE_TEMPLATE: add a required "target" field to bug.yml #11738

perillo opened this issue May 27, 2022 · 5 comments

Comments

@perillo
Copy link
Contributor

perillo commented May 27, 2022

Reading some open issues I noted that it is not easy to determine if a bug manifests only for some operating systems (like Windows).

I propose to add a new required field to bug.yml named target, containing the arch-os-abi triple.

The Zig compiler should also have a command to display the native target.
Currently the only method I know is zig targets | grep -A 512 native

Thanks.

@perillo
Copy link
Contributor Author

perillo commented May 27, 2022

An alternative is to have a builtin field, with a dump of the content of the builtin package.

@Luukdegram
Copy link
Member

An alternative is to have a builtin field, with a dump of the content of the builtin package.

The command zig build-obj --show-builtin will dump the contents of builtin for the native target.

@perillo
Copy link
Contributor Author

perillo commented May 27, 2022

Here is a simple patch to add support for dumping the native target in the zig env command:

diff --git a/src/print_env.zig b/src/print_env.zig
index ad772d416..f1a786392 100644
--- a/src/print_env.zig
+++ b/src/print_env.zig
@@ -21,6 +21,10 @@ pub fn cmdEnv(gpa: Allocator, args: []const []const u8, stdout: std.fs.File.Writ
     const global_cache_dir = try introspect.resolveGlobalCacheDir(gpa);
     defer gpa.free(global_cache_dir);
 
+    const info = try std.zig.system.NativeTargetInfo.detect(gpa, .{});
+    const triple = try info.target.zigTriple(gpa);
+    defer gpa.free(triple);
+
     var bw = std.io.bufferedWriter(stdout);
     const w = bw.writer();
 
@@ -42,6 +46,9 @@ pub fn cmdEnv(gpa: Allocator, args: []const []const u8, stdout: std.fs.File.Writ
     try jws.objectField("version");
     try jws.emitString(build_options.version);
 
+    try jws.objectField("target");
+    try jws.emitString(triple);
+
     try jws.endObject();
     try w.writeByte('\n');
     try bw.flush();

The zig env output on my system is:

{
 "zig_exe": "/code/prefix/zig/stage1/bin/zig",
 "lib_dir": "/code/prefix/zig/stage1/lib/zig",
 "std_dir": "/code/prefix/zig/stage1/lib/zig/std",
 "global_cache_dir": "/home/manlio/.cache/zig",
 "version": "0.10.0-dev.2424+b3672e073",
 "target": "x86_64-linux.5.17.9...5.17.9-gnu.2.19"
}

@perillo
Copy link
Contributor Author

perillo commented May 27, 2022

Here is a patch for bug.yml:

diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml
index 31fb479b5..c73636e83 100644
--- a/.github/ISSUE_TEMPLATE/bug.yml
+++ b/.github/ISSUE_TEMPLATE/bug.yml
@@ -17,6 +17,14 @@ body:
       placeholder: "0.9.0-dev.1275+ac52e0056"
     validations:
       required: true
+  - type: input
+    id: target
+    attributes:
+      label: Native Target Triple
+      description: "The target field from `zig env`"
+      placeholder: "x86_64-linux.5.17.9...5.17.9-gnu.2.19"
+    validations:
+      required: true
   - type: textarea
     id: repro
     attributes:

It depends on PR #11741, and probably the label and description should be improved.

perillo added a commit to perillo/zig that referenced this issue May 28, 2022
Add a new required field "Zig Target Triple" to the bug.yml template.

Closes ziglang#11738
@andrewrk
Copy link
Member

andrewrk commented Jun 2, 2022

No thank you

@andrewrk andrewrk closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants