Skip to content

Conversation

wrmsr
Copy link

@wrmsr wrmsr commented Jun 13, 2025

Description

click was set to <8.1.8 in bb18b0c in #1200 due to this test run failing.

Looking at the click diff, _pipepager was changed to shutil.which the cmd it's given, where it previously just dumped it into subprocess.Popen with shell=True. Test code tries to set the pager to a multi-arg shell invocation, not a which-able path to a single file.

I've changed it to write out an executable temp file to pass as the pager, and that seems to work on my box.

I'm not familiar with the project's supported environments and how well this fits into them, but this seems to fix the problem on my box.

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).

@rolandwalker
Copy link
Contributor

rolandwalker commented Jun 14, 2025

It would be great to have some bisecting done to narrow down the problem. I took a look at the most likely parts of the click source and didn't see recent suspect changes.

@wrmsr
Copy link
Author

wrmsr commented Jun 17, 2025

Reproducing it locally, narrowed it down to 299efb82e1a3d34d870129dc0c677c6efb42d811 but haven't investigated more as I'm unfamiliar with all this machinery lol.

@rolandwalker
Copy link
Contributor

Ah, that's very helpful!

@wrmsr wrmsr force-pushed the wrmsr_20250613_remove_click_limit branch from 5050acc to a0b99dd Compare August 6, 2025 04:37
@wrmsr wrmsr marked this pull request as ready for review August 6, 2025 04:51
@wrmsr wrmsr force-pushed the wrmsr_20250613_remove_click_limit branch from 8a404f3 to a2c092d Compare August 6, 2025 05:24
@rolandwalker
Copy link
Contributor

@wrmsr your analysis is great, thanks! I tried out a different idea in #1305, and the tests pass. My bumbling with env variables in #1241 was never going to work.

However, the tests were telling us something! We allow setting a pager in the config file with arguments:

pager = 'less -iRSMwF --use-color'

and that is going to break with the new click, right?

@wrmsr
Copy link
Author

wrmsr commented Aug 6, 2025

@rolandwalker >_< forgot to close the mkstemp fd, seems like linux won't exec an open-for-write file. Tested locally on 🍎 and 🐧 and it passes. Mind rerunning to confirm?

Not saying this is the proper fix if a configurable multi-token 'shelly' pager command is supported. At least for the very first breaking click version - the one with the diff I linked - I don't think that's doable without moving this kind of hack into mycli since the whole thing is shlex.which'd. However it seems on modern clicks - since 3/27 (8.2.0?) - it tries to shlex.split the pager env var and shutil.which only the first word, which looking at it should work, and yet didn't when I initially posted this branch with the latest click version. There's surely a way to get it working under that, I'll look at that later.

@rolandwalker
Copy link
Contributor

However it seems on modern clicks - since 3/27 (8.2.0?) - it tries to shlex.split the pager env var

Great! Then we only have to blocklist some range of versions.

@rolandwalker
Copy link
Contributor

Do you need me to handle the lint fixes?

@rolandwalker
Copy link
Contributor

I opened an issue with click based on your research: pallets/click#3039

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 this pull request may close these issues.

2 participants