-
-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlatformIO not rebuilding symlinked changed files #4316
Comments
The bug is fixed in the latest development version of SCons. See SCons/scons#4121 There are +/- for timestamp decider. See docs for them https://scons.org/doc/production/HTML/scons-user.html#idm46358241264176 If you want to use "make"-like decider, override it in PRE Script Import("env")
env.Decider("make") |
Sounds great, I had no idea that platformio supports such hooks! I've tested your snippet and it works well - for non-symlinked files, that is. That means the SCons issue isn't just limited to the md5sum decider but also affects the 'make' decider! Looking at the SCons patch this is plausible since they also fixed the mtime getter for symlinks. FWIW, As of 2022-06-20, the latest available SCons release is 4.3.0 - which is from November 2021 and hence doesn't contain the symlink-follow fixes. Thus, besides configuring the make decider I also 'backported' the mtime fix from upstream to the platformio copy: --- /home/juser/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Node/FS.py.orig 2022-06-20 23:56:24.974977949 +0200
+++ /home/juser/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Node/FS.py 2022-06-20 23:58:26.650017670 +0200
@@ -733,10 +733,7 @@
return SCons.Node._rexists_map[self._func_rexists](self)
def getmtime(self):
- if self.islink():
- st = self.lstat()
- else:
- st = self.stat()
+ st = self.stat()
if st:
return st[stat.ST_MTIME] And with that (and the make decider), symlinked files are now properly rebuilt with platformio! For completeness, I just put your snippet into
to my platformio.ini |
It doesn't seem to work anymore on macOS (Big Sur 11.6.7) since the upgrade to 1.6.3.
Here is my
When I compile the linked file : ; platformio.ini
build_src_filter = -<*> +<example.cpp> Everything is going well:
However, if I compile the symlink: ; platformio.ini
build_src_filter = -<*> +<main.cpp> Changes in
Have you encountered this problem as well? |
@m1cr0lab does this solution with extra script work for you #4316 (comment) ? |
I don't think so 😕 # ~/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Node/FS.py
# line 255-258(+1)
def _copy_func(fs, src, dest):
shutil.copy2(src, dest)
st = fs.stat(src)
# fs.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
fs.chmod(dest, stat.S_IMODE(st.st_mode) | stat.S_IWRITE) And still nothing at the compilation:
|
Please re-read my comment. |
Well... I'm not sure I understand what I'm supposed to do 😁 ; platformio.ini
build_src_filter = -<*> +<main.cpp>
extra_scripts = pre:extra_script.py # extra_script.py (located in the same directory as platformio.ini)
Import("env")
env.Decider("make") Nothing new:
|
In fact, if I use the tip given by @gsauthof above: # ~/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Node/FS.py
# line 735-745
def getmtime(self):
# if self.islink():
# st = self.lstat()
# else:
# st = self.stat()
st = self.stat()
if st:
return st[stat.ST_MTIME]
else:
return None Then it works:
Thank you all for your help! 🙏 |
Thanks! We have just patched SCons version in the registry. Could you remove |
It works like a charm!
|
What kind of issue is this?
Configuration
Operating system: Fedora 35
PlatformIO Version (
platformio --version
):Platformio was installed via:
Description of problem
Platformio CLI doesn't rebuild changed files when they are symlinked.
This is caused by an SCons bug: MD5-timestamp decider does no longer follow symlinks
Steps to Reproduce
include
subdirectorysrc/main.c
pio run --verbose
pio run --verbose
againActual Results
src/main.c
isn't rebuiltExpected Results
src/main.c
is rebuiltIf problems with PlatformIO Build System:
The content of
platformio.ini
:i.e. pretty vanilla
Source file to reproduce issue:
Additional info
See also my post on the Platformio forum: https://community.platformio.org/t/force-platformio-to-use-modification-time-comparisons-for-determining-whether-a-file-changed/28292
So I'm interested in a work-around, i.e. a way to tell Platformio to simply use the SCons timestamp-newer decider instead of the default md5sum one.
Even if you update the minimal required SCons version in your Platformio Python package dependencies, I still would prefer to use timestamp-newer decider, because I consider the SCons md5sum default as suboptimal and a waste of CPU cycle, in the best case.
Of course, I wouldn't be against Platformio being changed to even use the timestamp-newer decider, by default.
The text was updated successfully, but these errors were encountered: