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

coreos-overlay-diff.py is broken with Python sh 2.x #159

Closed
chewi opened this issue Jul 19, 2024 · 4 comments
Closed

coreos-overlay-diff.py is broken with Python sh 2.x #159

chewi opened this issue Jul 19, 2024 · 4 comments

Comments

@chewi
Copy link
Contributor

chewi commented Jul 19, 2024

Description

This script was written against sh 1.x. There were some significant breaking changes in 2.x, notably the way pipes are constructed and the type returned.

Impact

Environment and steps to reproduce

  1. Set-up: I was running vanilla Gentoo with the latest dev-python/sh. Fedora 39 and 40 also have 2.x.
  2. Task: Simply running coreos-overlay-diff.py.
  3. Action(s): As above.
  4. Error: After the diff, you get an error like this:
↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ Diff for flatcar-overlay ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

Traceback (most recent call last):
  File "/home/chewi/Projects/flatcar/flatcar-build-scripts/./coreos-overlay-diff.py", line 190, in <module>
    display_difference(args.THEIRS, args.ours, os.path.basename(os.path.abspath(".")), recurse=True)
  File "/home/chewi/Projects/flatcar/flatcar-build-scripts/./coreos-overlay-diff.py", line 109, in display_difference
    commits_we_have = commits_to_pick(src=to_ours, dst=from_theirs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chewi/Projects/flatcar/flatcar-build-scripts/./coreos-overlay-diff.py", line 58, in commits_to_pick
    _commits_src_has_without_cherry = cut(grep(git.cherry(dst, src, _bg=False),
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/sh.py", line 1508, in __call__
    rc = self.__class__.RunningCommandCls(cmd, call_args, stdin, stdout, stderr)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/sh.py", line 737, in __init__
    self.wait()
  File "/usr/lib/python3.12/site-packages/sh.py", line 799, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/lib/python3.12/site-packages/sh.py", line 826, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_2: 

  RAN: /usr/bin/grep '+ 6cd2151eab1e0ff4834b94f250c9a78b0d29ca0e
+ fb79dad6fd97054290620943ea0bcb6b69a98137
+ 7e0a4836796bd5986697a9f27dccaff25f0ba787
+ e3903f11930d9c04f4cf4c047cf2c794aca9ac19
+ 6045acb9720b3bfc4f1f0c77907011e8abf25907
+ 06fa6b4913afbfcc72cccfdee94941aaf0034865
' '^+'

  STDOUT:


  STDERR:
/usr/bin/grep: ^+: No such file or directory

Expected behavior

It outputs information about which commits to pick.

Additional information

I would fix this now, but I imagine it's still used in places that don't have sh 2.x. We could support both, but quite a few lines would need to be duplicated. The syntax is quite different.

@jepio
Copy link
Member

jepio commented Jul 19, 2024

@sayanchowdhury / @tormath1 do we use this script?

@tormath1
Copy link
Contributor

@chewi
Copy link
Contributor Author

chewi commented Jul 22, 2024

Seems likely, given that I can't see coreos-overlay-diff.py referenced anywhere across the org. @krnowak, please could confirm. If it's redundant, I'll just close this and drop it in #160.

@krnowak
Copy link
Member

krnowak commented Jul 23, 2024

@chewi: I don't think I have ever used the script. Feel free to kill it.

@chewi chewi closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
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

No branches or pull requests

4 participants