[Scons-users] A problem regarding CacheDir

Steve Hill (Wireless) Steve.Hill1 at viavisolutions.com
Tue Dec 20 06:33:17 EST 2022


OK, sorry to reply to my own post but I've discovered the root cause to this problem. Back in the days of Python 2 we had a problem with parallel builds due to the default behaviour of file handles being inherited. As a result, we had to monkey patch open to change the default behaviour. This is still there today, in a dusty corner of our codebase, and it has not been updated to support the 'x' mode so was the cause of this problem.

Apologies for the disruption.

S.

From: Scons-users <scons-users-bounces at scons.org> On Behalf Of Steve Hill (Wireless) via Scons-users
Sent: 20 December 2022 08:07
To: SCons users mailing list <scons-users at scons.org>
Cc: Steve Hill (Wireless) <Steve.Hill1 at viavisolutions.com>
Subject: [Scons-users] A problem regarding CacheDir

EXTERNAL EMAIL: Do not click links or open attachments unless you know and trust the sender.

Hi all,

I have decided to have a play with using CacheDir with SCons 4.2.0 on Windows 10 with Python 3.8. The first time that I ran this, it worked (in so far as the - local, for now - cache directory was created) but any subsequent runs fail with a "Bad file descriptor" error when it tries to look up objects in the cache. Digging into the code, the issue seems to be with this line:

            with open(config_file, 'x') as config:

Event though the config file *does* exist, open() does not seem to be raising a FileExistsError but, when the file is used to write the default config (json.dump(self.config, config)), you get the "Bad file descriptor" exception. By putting the following hack before that line, the cache bursts into life:

            if os.path.exists(config_file):
                raise FileExistsError()

I just wanted to check: is CacheDir supported under Windows?

Thanks,

S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20221220/2dd834bd/attachment-0001.htm>


More information about the Scons-users mailing list