[aur-dev][PATCH] config: allow reading both the proto file and the modified config

Eli Schwartz eschwartz at archlinux.org
Mon Apr 16 01:41:45 UTC 2018


On 04/12/2018 02:22 PM, Nodiv Byzero wrote:
> The point is that there are few places where config_load() gets called
> in the sequential order (the same request) and every time it loads and
> parses data.

Are these also places where if (!isset($AUR_CONFIG)) fails to actually
fulfill its sole reason to exist?

Not that it matters... if for some reason we are loading the config very
fast and scribbling over each other, because $AUR_CONFIG is not yet set
when we begin the second config_load() execution, checking if $config is
already loaded won't help -- it's a local variable.

So, question: can you show me code where $config would *not* be `false`?

Because I think this proposition would be either a no-op or a reason to
file a severely major upstream php bug complaining that the variables
are leaking all over the floor.

...

That being said, yes, there is a race condition where you call
config_load() twice, and they both set $AUR_CONFIG.

Elevating $config and $default_config to globals, *then* using them as
additional file access caches to micro-optimize one or two disk ops,
seems wasteful to me. It's not like this is being run in a tight loop.

If any effort should be spent to fix this, rather than introducing
painful, non-obvious code, we should introduce some sort of proper cache.

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-dev/attachments/20180415/758e6616/attachment.asc>


More information about the aur-dev mailing list