Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

workaround for a longer AUR RPC URI #238

Closed
wants to merge 2 commits into from
Closed

Conversation

wilzbach
Copy link

this is a workaround for #209

unfortunately the code got messy and I would prefer if the AUR devs could just increase the limit. Nevertheless it works fine for me :-)

@rmarquis
Copy link
Owner

Yes, the code is horribly messy. No offense here, it's just that this issue isn't simple to solve as you've seen it.

I was thinking about asking for increasing the URI limit server side, but even if we don't take the security issues of doing so I'm sure some people would achieve to break the new limit again. This has to be solved by the helper.

I will however won't merge the code in this state. This code is called multiple time when it is only really useful in a single case: download of the very first json file when checking for update. All other cases are irrelevant here (at least, I believe that someone trying to install 350+ AUR packages from the command line does something wrong).

I've done some research and I found the jq library - using it might result in a shorter, cleaner and more maintainable code. I only dislike the idea of adding another AUR dependency to pacaur, but this might be really needed here.

@wilzbach
Copy link
Author

Unfortunately I agree that code is terribly ugly (I needed a temporary workaround).
One thing I want to note is that the splitting + merging only starts when the partLength is exceeded (otherwise the normal json file is returned as before), so there's not that much overhead ;-)

I already worked with the jq library and - as you said - it would really help a lot to simplify this awk/sed monsters. To be honest I really considered to use it, but then dropped the idea because I thought you probably won't like the extra dependency.

So to summarize: we keep the approach of splitting and merging if the number of packages exceeds a limit, but just use jq for the merging?

@rmarquis
Copy link
Owner

As a temporary workaround your code might be all you need for now.

So to summarize: we keep the approach of splitting and merging if the number of packages exceeds a limit, but just use jq for the merging?

I had a slightly different approach in mind:

  • I'd check the current URI length and divide it if the threshold is reached (ie, ~8190 characters), instead of a predetermined number. This would ensure a minimal number of call to the AUR API.
  • download the 2 (or 3 or 4 ...) json file as rpc1.json, rpc2.json
  • merge and continue as usual.

And you are right, I dislike the idea of adding another dependency. Part of the success of pacaur is its minimal requirement, and I'll try to implement this without jq first.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants