-
Notifications
You must be signed in to change notification settings - Fork 465
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
Integer truncation -- regression between 3.1 and 3.2 (and different from ruby sass) #1216
Comments
I've bisected it to this commit: 925220c Looking at the commit it's not obvious to me what changed... @xzyfer any ideas? Using this (yes it leaks memory): // entries/main1.cpp
#include "sass_context.h"
#include <cstring>
#include <iostream>
#include <string>
int main() {
char* src = (char*)malloc(sizeof(char) * 50);
strcpy(src, "a { width: 3.0px }");
struct Sass_Data_Context* context = sass_make_data_context(src);
sass_compile_data_context(context);
struct Sass_Context* ctx = sass_data_context_get_context(context);
std::string output = sass_context_get_output_string(ctx);
std::cout << output << std::endl;
return static_cast<int>(output != "a {\n width: 3px; }\n");
} C_SOURCES := $(wildcard *.c)
C_OBJECTS = $(patsubst %.c,build2/c/%.o,$(C_SOURCES))
CPP_SOURCES := $(wildcard *.cpp)
CPP_OBJECTS = $(patsubst %.cpp,build2/cpp/%.o,$(CPP_SOURCES))
MAIN_SOURCES := $(wildcard entries/*.cpp)
OUTS = $(patsubst entries/%.cpp,%.out,$(MAIN_SOURCES))
all: main1.out
build2/c/%.o: %.c
@mkdir -p build2/c/
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./ -c $^ -o $@ -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
build2/cpp/%.o: %.cpp
@mkdir -p build2/cpp/
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./ -c $^ -o $@ -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
build2/mains/%.o: entries/%.cpp
@mkdir -p build2/mains
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I./ -c $^ -o $@ -c -O2 -fPIC -std=c++0x -Wall -Wno-parentheses
main1.out: build2/mains/main1.o $(C_OBJECTS) $(CPP_OBJECTS)
g++ -pthread -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro $^ -L./libsass -o $@ -fPIC -lstdc++ -ldl
.PHONY: clean
clean:
rm -rf build2 main1.out # script.sh
(make -f Makefile2 clean && make -f Makefile2 -j 12 && ./main1.out) || false $ git bisect start
$ git bisect good 3.1.0
$ git bisect bad 3.2.4
$ git bisect run ./script.sh |
Hmm that doesn't sound right. There were some refactors around number output in the previous release. We'll try get this into the next patch. Since this difference doesn't change the semantics of the output it's not a high priority, but should be an easy enough fix. |
Well, now I can't reproduce the ruby behaviour. I seem to consistently be getting the 3.0px output in ruby-sass, though I'm on a different machine... |
http://sassmeister.com/gist/de3195efdb01319e4cf7 confirms regression |
Seems I had my binaries confused :S ruby-sass actually compiles the same as libsass, so this is less of a regression and more of a match-ruby I guess :) |
This is important to us. A deviation from this behaviour in a new version is still a regression. |
I should clarify, I made a mistake when creating the ticket (probably two terminals, with one where I accidentally had The behaviour in 3.1 was "wrong" or "not matching ruby sass", and in 3.2 it now matches-sass. So ignoring ruby-sass it looks like a regression, but in reality it's actually a bugfix. I'll update the original post so it makes more sense. |
Seems like static_value treats values like 3.0px as const strings preventing the trailing zero reduction. A related issue is #550, where it is favoured to treat values like .01px as strings, otherwise they get transformed into 0.01px. |
EDIT This post has been edited to reflect the actual worldstate and not the erroneous state when I originally created the ticket. I had some wackiness in my environment which mislead me :(
Input:
Output (libsass 3.1):
Output (libsass 3.2.4):
Ruby sass 3.4.12:
The text was updated successfully, but these errors were encountered: