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

GH-38049: [R] Prevent on_rosetta() from warning #38052

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

jonkeane
Copy link
Member

@jonkeane jonkeane commented Oct 5, 2023

Rationale for this change

Stop extraneous warnings.

What changes are included in this PR?

Prevent warning when detecting translation, but on x86

Are these changes tested?

Yes

Are there any user-facing changes?

Yes, there will be fewer extraneous warnings.

@github-actions github-actions bot added Component: R awaiting committer review Awaiting committer review labels Oct 5, 2023
@jonkeane
Copy link
Member Author

jonkeane commented Oct 5, 2023

@github-actions crossbow submit test-r-install-local

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

Revision: 58ff39b

Submitted crossbow builds: ursacomputing/crossbow @ actions-1c137994ff

Task Status
test-r-install-local Github Actions

@jonkeane
Copy link
Member Author

jonkeane commented Oct 5, 2023

@github-actions crossbow submit test-r-install-local

@github-actions
Copy link

github-actions bot commented Oct 5, 2023

Revision: 673a604

Submitted crossbow builds: ursacomputing/crossbow @ actions-7c4a2d95fb

Task Status
test-r-install-local Github Actions

@jonkeane jonkeane changed the title GH-38049: [R] Prevent on_rosetta() from warning [WIP] GH-38049: [R] Prevent on_rosetta() from warning Oct 6, 2023
@jonkeane jonkeane marked this pull request as ready for review October 6, 2023 00:52
Comment on lines +19 to +20
# There is no warning
expect_warning(on_rosetta(), NA)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't actually able to find a way to test that the console output from stderr doesn't show here. I tried both expect_output(..., NA) and expect_silent(...) as well as capturing the output with capture_output(...) and capture.output(...) but none of those seemed to actually capture the console warning I'm seeing. This is probably fine. I've tested locally and the output is supressed on my system.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Oct 6, 2023
Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting changes Awaiting changes labels Oct 6, 2023
@paleolimbot
Copy link
Member

(It floated in last night that the system("...", ignore.stdout = TRUE) == 1 might be sufficient if the return code is what's causing the warning. Either way!)

@paleolimbot
Copy link
Member

I also checked this on 10.13 where it correctly silenced a warning that occurred as a result of a non-zero exit status/unknown old. Thanks again!

@paleolimbot paleolimbot merged commit fdecb6a into apache:main Oct 6, 2023
@paleolimbot paleolimbot removed the awaiting merge Awaiting merge label Oct 6, 2023
@jonkeane
Copy link
Member Author

jonkeane commented Oct 6, 2023

Thanks for merging.

For posterity only:

(It floated in last night that the system("...", ignore.stdout = TRUE) == 1 might be sufficient if the return code is what's causing the warning. Either way!)

We actually do need to inter to get the output. system("...", ignore.stdout = TRUE) == 1 will be 1 if you're on x86 (because the command failed to find sysctl.proc_translated), but 0 on an M* processor regardless if you're under emulation or not since the command succeeded at finding the property and printing 0 or 1 to the console depending on if you're in emulation or not. There might be a cleaner system2 incantation, but I didn't want to drift too far from what was there.

@jonkeane
Copy link
Member Author

jonkeane commented Oct 6, 2023

And, actually writting that out now made me realize I had introduced a bug resolved in #38083 I tested this code on x86 but not M*

paleolimbot pushed a commit that referenced this pull request Oct 6, 2023
### Rationale for this change

A follow on to #38052 which introduced a small bug

### What changes are included in this PR?

Don't ignore the stdout which is the mechanism to tell if under emulation.

### Are these changes tested?

I tested these locally:

On an M2 with emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "1"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] TRUE
```

On an M2 without emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "0"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

On an x86 (note the warning message suppression is what #38052 resolved):

```
>  identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE,  :
  running command 'sysctl -n sysctl.proc_translated >/dev/null 2>/dev/null' had status 1
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE) :
  running command 'sysctl -n sysctl.proc_translated 2>/dev/null' had status 1
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

### Are there any user-facing changes?

No / the functionality is restored

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit fdecb6a.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 5 possible false positives for unstable benchmarks that are known to sometimes produce them.

JerAguilon pushed a commit to JerAguilon/arrow that referenced this pull request Oct 23, 2023
### Rationale for this change

Stop extraneous warnings.

### What changes are included in this PR?

Prevent warning when detecting translation, but on x86

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes, there will be fewer extraneous warnings.
* Closes: apache#38049

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
JerAguilon pushed a commit to JerAguilon/arrow that referenced this pull request Oct 23, 2023
…#38083)

### Rationale for this change

A follow on to apache#38052 which introduced a small bug

### What changes are included in this PR?

Don't ignore the stdout which is the mechanism to tell if under emulation.

### Are these changes tested?

I tested these locally:

On an M2 with emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "1"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] TRUE
```

On an M2 without emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "0"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

On an x86 (note the warning message suppression is what apache#38052 resolved):

```
>  identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE,  :
  running command 'sysctl -n sysctl.proc_translated >/dev/null 2>/dev/null' had status 1
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE) :
  running command 'sysctl -n sysctl.proc_translated 2>/dev/null' had status 1
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

### Are there any user-facing changes?

No / the functionality is restored

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
### Rationale for this change

Stop extraneous warnings.

### What changes are included in this PR?

Prevent warning when detecting translation, but on x86

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes, there will be fewer extraneous warnings.
* Closes: apache#38049

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…#38083)

### Rationale for this change

A follow on to apache#38052 which introduced a small bug

### What changes are included in this PR?

Don't ignore the stdout which is the mechanism to tell if under emulation.

### Are these changes tested?

I tested these locally:

On an M2 with emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "1"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] TRUE
```

On an M2 without emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "0"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

On an x86 (note the warning message suppression is what apache#38052 resolved):

```
>  identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE,  :
  running command 'sysctl -n sysctl.proc_translated >/dev/null 2>/dev/null' had status 1
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE) :
  running command 'sysctl -n sysctl.proc_translated 2>/dev/null' had status 1
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

### Are there any user-facing changes?

No / the functionality is restored

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
### Rationale for this change

Stop extraneous warnings.

### What changes are included in this PR?

Prevent warning when detecting translation, but on x86

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes, there will be fewer extraneous warnings.
* Closes: apache#38049

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…#38083)

### Rationale for this change

A follow on to apache#38052 which introduced a small bug

### What changes are included in this PR?

Don't ignore the stdout which is the mechanism to tell if under emulation.

### Are these changes tested?

I tested these locally:

On an M2 with emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "1"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] TRUE
```

On an M2 without emulation:

```
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
[1] "0"
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

On an x86 (note the warning message suppression is what apache#38052 resolved):

```
>  identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)), "1")
[1] FALSE
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE, ignore.stdout = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE,  :
  running command 'sysctl -n sysctl.proc_translated >/dev/null 2>/dev/null' had status 1
> system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)
character(0)
attr(,"status")
[1] 1
Warning message:
In system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE) :
  running command 'sysctl -n sysctl.proc_translated 2>/dev/null' had status 1
> identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE)), "1")
[1] FALSE
```

### Are there any user-facing changes?

No / the functionality is restored

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Dewey Dunnington <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[R] Rosetta detector has output when running on x86
2 participants