GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-127146: Skip test_netrc.test_security on Emscripten by hoodmane · Pull Request #136227 · python/cpython

Conversation

@hoodmane

@hoodmane hoodmane commented Jul 3, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Before #135816 it was skipped because pwd is missing on Emscripten. Now it isn't skipped because the test no longer requires pwd but it still doesn't work on Emscripten.

  • Issue: Emscripten: Get test suite passing #127146

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hoodmane
pythongh-127146: Skip test_netrc.test_security on Emscripten
6b0c452
Before python#135816 it was skipped because pwd is missing on Emscripten.
Now it isn't skipped because the test no longer requires pwd but it
still doesn't work on Emscripten.
@hoodmane hoodmane added tests Tests in the Lib/test dir skip news OS-emscripten labels Jul 3, 2025
@bedevere-app bedevere-app Bot added the awaiting review label Jul 3, 2025
@hoodmane
hoodmane requested a review from freakboy3742 July 3, 2025 08:24
@bedevere-app bedevere-app Bot mentioned this pull request Jul 3, 2025
Emscripten: Get test suite passing #127146
Closed
@cmaloney

cmaloney commented Jul 3, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Is this failing because of https://github.com/python/cpython/blob/main/Lib/netrc.py#L10C5-L12 (from gh-135815)?

This test is validating the security check is working right (added in gh-59189). Worried about disabling a test for a security check rather than just disabling the module (or fixing the security check).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@freakboy3742

freakboy3742 commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Is this failing because of https://github.com/python/cpython/blob/main/Lib/netrc.py#L10C5-L12 (from gh-135815)?

This test is validating the security check is working right (added in gh-59189). Worried about disabling a test for a security check rather than just disabling the module (or fixing the security check).

I'm not 100% sure about this. Unlike WASI, Emscripten reliably has os.getuid(); but it doesn't have pwd. So - the netrc._can_security_check() will pass (which means the test added for WASI test will fail); but the default test is failing (because the check performed by that test doesn't hold for Emscripten):

======================================================================
ERROR: test_security (test.test_netrc.NetrcTestCase.test_security)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/emscripten/buildarea/3.x.rkm-emscripten.emscripten/build/Lib/test/test_netrc.py", line 292, in test_security
    nrc = netrc.netrc()
  File "/home/emscripten/buildarea/3.x.rkm-emscripten.emscripten/build/Lib/netrc.py", line 88, in __init__
    self._parse(file, fp, default_netrc)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/emscripten/buildarea/3.x.rkm-emscripten.emscripten/build/Lib/netrc.py", line 155, in _parse
    self._security_check(fp, default_netrc, self.hosts[entryname][0])
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/emscripten/buildarea/3.x.rkm-emscripten.emscripten/build/Lib/netrc.py", line 164, in _security_check
    raise NetrcParseError(
        f"~/.netrc file owner ({fowner}) does not match"
        f" current user ({user})")
netrc.NetrcParseError: ~/.netrc file owner (uid 1002) does not match current user (uid 0) (None, line None)

----------------------------------------------------------------------
Ran 23 tests in 0.037s

FAILED (errors=1, skipped=1)

My immediate guess is that the _can_security_check() method should be modified to catch the Emscripten behavior (maybe by adding and os.getuid() != 0, or maybe even an explicit and sys.platform != "emscripten". @hoodmane may have another idea.

That said - it's interesting that this failure is also occurring with a file mode, which is similar to the failure reported as #135783 (although it's a very different issue). That might be complete coincidence... but it's an interesting simliarity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hoodmane

hoodmane commented Jul 10, 2025

Copy link
Copy Markdown
Contributor Author

Closed in favor of #136509.

cmaloney reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hoodmane hoodmane closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@freakboy3742 freakboy3742 Awaiting requested review from freakboy3742

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review OS-emscripten skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@hoodmane @cmaloney @freakboy3742
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.