<farkuhar>
beerman: i think the surprising behaviour of prt-get update -fr foo bar (when either foo or bar is not installed) can be traced to line 607 in prtget.cpp. The code path that checks whether packages are installed doesn't get executed if you give prt-get more than one pkg name.
<farkuhar>
before constructing a patch, it would help to have a definitive idea on what would constitute "smarter" parsing of such a command. Do you want it to stop and report an error if ANY pkg given on the command line is not installed? continue with the update operation for those packages where it makes sense, but report a warning about the other packages?
<beerman>
all i can voice is my personal opinion: if prt-get update foo fails because foo is not installed, and prt-get update foo bar attempts to update foo even if bar is an invalid ports name
<beerman>
i would rather expect it to throw an error to say foo is not installed and bar is shite
<beerman>
but thats without having spend more thoughts on the topic either, i had to do a few commits and i am not done but now i am putting crux aside for real life activities ;)
<beerman>
at least after rebasing contrib, which should be a quick matter
<farkuhar>
noted, thanks for the input. Based on my current understanding of prtget.cpp, it's probably not too hard to implement the behaviour you expected. I'll work on it later, after real life activities of my own ;)
<jaeger>
I would also expect prt-get to stop with an error if you tell it to update a package that is not installed
ivandi has quit [Quit: WeeChat 3.5]
ivandi has joined #crux-devel
ivandi has quit [Quit: WeeChat 3.5]
ivandi has joined #crux-devel
pitiIIo has quit [Ping timeout: 272 seconds]
pitiIIo has joined #crux-devel
<jaeger>
httpup has a bug in it that gcc 11/12 don't like: http://ix.io/3Yn7
<jaeger>
I've worked around it in 3.7 core for now but if someone more well-versed with c++ knows the proper fix, let me know
<groovy3shoes>
jaeger, i think you might need to change line 92 to `delete[] pwd;` (i found a nearly identical issue here, albeit with a much more helpful error message attached: https://github.com/bazelbuild/bazel/issues/1347 )
<braewoods>
yep, delete[]. it's moot for this data type since it's a simple builtin but for consistency it needs to be delete[].
<braewoods>
the allocators for arrays and scalars are different and all
<braewoods>
weird though. why are they using new[] for such a trivial static allocation? hm.
<braewoods>
stack based would make more sense.
<braewoods>
oh wow this utility is so ancient
<braewoods>
yea. a stack buffer would make more sense for this situation.
<braewoods>
I have no idea why they chose this approach.
<braewoods>
Cisms sometimes make more sense even in C++.
<groovy3shoes>
if i had to guess, i'd say it's to avoid permanent space in the main() stack frame for such a brief need. but 256 bytes isn't so much, so i dunno.
<braewoods>
that makes little sense. they do use one above for urlBuf in the main.cpp file
<braewoods>
in any case i'm preparing a patch to refactor this code section
<braewoods>
stack buffers are so generous these days, 1K isn't enough to worry about
<groovy3shoes>
yeah
<groovy3shoes>
and it's not like there's no cost to allocating/deallocating
<braewoods>
stack avoids the cost of cleanup and more
<braewoods>
i can't say i understand the reasoning of the original author for this. i always use stack buffers for small or temporary data stores
<braewoods>
new would make sense if the data was intended to persist but it isn't.
<braewoods>
the end result is just copied into a C++ string object
<jaeger>
ok, will take a look in a bit
<jaeger>
thanks for checking it out
<jaeger>
That seems to work fine, thanks again. I'll get that into httpup.git and make a new release for it soon
<jaeger>
any objection to me mentioning your name in the changelog?
<braewoods>
jaeger: not really
<braewoods>
honestly get the feeling a lot of the ancient crux source code should be rebuilt with plain C seeing as people seem to find the C++ implementation unapproachable
<jaeger>
Agreed. I started a full rewrite of pkgutils in C but have limited time to pursue it... with that said, maybe a more attainable goal for the short term would be to rewrite or replace prt-get in C first, then expand later
<braewoods>
jaeger: i was also considering whether something like Lua could be a useful addition since it's a proper scripting language unlike shell. allows for stuff that is hard or impossible with shell.
<braewoods>
I've been writing Lua -> C bridge code for awhile and it's pretty simple to do. I was surprised.
<braewoods>
It could make the utilities more approachable for regular scripters. Main reason it seems interesting.
dlcusa_ has joined #crux-devel
dlcusa has quit [Ping timeout: 240 seconds]
<jaeger>
worth thinking about, at least. I've never done any plugin or scripting language integration with C so no idea how that works
<beerman>
i like that idea 👍️ also good catch and fix, nice work everybody