Skip to content

Bizarre incompatibility between googlecloudprofiler and libsass #413

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

Closed
danking opened this issue Dec 7, 2022 · 2 comments
Closed

Bizarre incompatibility between googlecloudprofiler and libsass #413

danking opened this issue Dec 7, 2022 · 2 comments

Comments

@danking
Copy link

danking commented Dec 7, 2022

Hey all,

Apologies for bringing what I suspect will be a terribly hard bug to nail down.

Create a Dockerfile with this contents:

FROM python:3.7
RUN pip3 install google-cloud-profiler==4.0.0 libsass==0.22.0
WORKDIR /foo
RUN printf '$devil-gray: #123\n' > variables.scss
RUN printf '@import "variables.scss";\nhtml { color: $devil-gray; }' > foo.scss
RUN printf >good.py '\
import sass \n\
import os \n\
d = os.path.abspath(".") \n\
sass.compile(dirname=(d, d), output_style="compressed", include_paths=[d])'

RUN printf >bad.py '\
import googlecloudprofiler \n\
import sass \n\
import os \n\
d = os.path.abspath(".") \n\
sass.compile(dirname=(d, d), output_style="compressed", include_paths=[d])'

Build it:

docker build . -t foo

And see this bizarre behavior:

(base) dking@wm28c-761 /tmp % docker run foo /bin/bash -c 'python3 good.py ; cat *.css'
html{color:#123}
(base) dking@wm28c-761 /tmp % docker run foo /bin/bash -c 'python3 bad.py ; cat *.css'
html{color:#}

In case it's not clear: I expected bad.py to produce the same CSS file as good.py

@danking
Copy link
Author

danking commented Dec 7, 2022

FWIW, this is not a problem with older versions of google cloud profiler. You have to additionally place an upper bound on protobuf because google cloud profiler has an unrestricted dependency on it (🤦).

RUN pip3 install 'google-cloud-profiler<4.0.0' 'protobuf<=3.20.0' libsass==0.22.0

Does libsass use protobufs?

@asottile
Copy link
Member

asottile commented Dec 7, 2022

I deleted all of google-cloud-profiler except for #include <iostream> which is enough to trigger the bad behaviour

the cause from what I can tell is the link flag that profiler uses: -static-libstdc++ -- this breaks any future imports of extensions which use c++ code that may be compiled against a different libstdc++ -- I assume the libgcc1 link is probably just as problematic

if I remove the static link flags it all passes again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants