patchThe GNU Bourne-Again SHell - Patches: patch #10269, builtins/set: copy option names so...


You are not allowed to post comments on this tracker with your current authentication level.

patch #10269: builtins/set: copy option names so they can be freed as expected

Submitter:  Tim Harder <radhermit>
Submitted:  Sat 30 Jul 2022 05:44:29 AM UTC
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  None Open/Closed:  Open

Mon 29 Aug 2022 07:38:47 PM UTC, comment #4: 

comment #3:

> If that's the issue, why not simply use xfree in your wrapped API?

Somehow I missed that when trying solutions while running tests for my bindings under valgrind, but anyway... thanks that works.

Tim Harder <radhermit>
Mon 29 Aug 2022 06:54:24 PM UTC, comment #3: 

If that's the issue, why not simply use xfree in your wrapped API?

Chet Ramey <chet>
Group administrator
Mon 29 Aug 2022 04:43:46 PM UTC, comment #2: 

That's fair as that makes sense from a C perspective.

Giving a little content for my usage of bash and why this is necessary for me... I'm wrapping bash's C API in a rust library and have to call back into C to properly free objects.

In this case, the general free() provided by C obviously isn't provided by bash's API as that would be strange, but strvec_dispose() is which can be used if this patch is applied.

Tim Harder <radhermit>
Mon 29 Aug 2022 03:27:05 PM UTC, comment #1: 

Thanks for the suggestion. I think it's just as easy to use free() on the return value from get_minus_o_options(). I won't be installing this patch.

Chet Ramey <chet>
Group administrator
Sat 30 Jul 2022 05:44:29 AM UTC, original submission:  

While trying to use the list of all `set` and `shopt` options externally, I noticed shopt uses savestring() and thus can be freed via strvec_dispose() while set does not even through the functions are quite similar.

I think it makes sense to handle both of these the same way so the attached patch adds savestring() calls for `set` options as well.

Tim Harder <radhermit>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by radhermit (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-29 chet StatusNone Wont Do
    2022-07-30 radhermit Attached File- Added copy_set_option_names.patch, #53487

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code