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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

haven::write_sav can crash #171

Closed
rubenarslan opened this Issue Jun 2, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@rubenarslan
Copy link

rubenarslan commented Jun 2, 2016

Are you already interested in crash reports? I'm not sure, I just eagerly installed from the master branch to test the date and label writing to .sav.
If not, ignore this and sorry 馃槄

Writing the following data results in a crash on my platform 1 out of 3 times. If I use all the data and not just a tiny slice, it always crashes.
I'm not sure how to report details about crashes. R quits with a fatal error and Rstudio reloads, I don't get a message. If I turn debug on the function Rstudio crashes too and I can see from the Mac OS X reporting tools that it's a segfault, but I'm not sure whether that's now related to haven or RStudio.

widgets = structure(list(time_period = structure(NA_integer_, .Label = c("quaternary", 
    "neogene", "paleogene", "cretaceous", "jurassic", "triassic", 
    "permian", "carboniferous", "devonian", "silurian", "ordovician", 
    "cambrian"), class = "factor"), partner = NA_integer_), .Names = c("time_period", 
    "partner"), row.names = 1L, class = "data.frame")
haven::write_sav(widgets, "w.sav")

sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.4 (El Capitan)

Oh, also, this is more minor: when installing via devtools, it complained about missing build tools. Solution was to go to 3.3.0, so I was a bit confused by that (I had all build tools).

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Jun 2, 2016

This is a bug in ReadStat... working on a fix.

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Jun 2, 2016

Fixed in WizardMac/ReadStat@8d5e263.

Note that to get the fix, haven will need to be updated to work with changed ReadStat APIs.

@hadley hadley closed this in d37c341 Jun 2, 2016

@rubenarslan

This comment has been minimized.

Copy link

rubenarslan commented Jun 2, 2016

Works like a charm (ie reads and writes nicely, reproduces item and value
labels).

Except SPSS does not open the files anymore ^^.
For the mtcars write_sav example the error in SPSS V20
yields is #1405 in column 8.
And it says something is an invalid file.

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Jun 2, 2016

I don't have access to SPSS so I can't test directly. Can you please try two small examples using value labels:

  • One where all string values (not necessarily labels) are EXACTLY the same length -- and longer than 8 characters
  • One where at least one string value has a different length from the others -- and at least one string value has a length longer than 8 characters

Make sure that value labels are being used in both cases. Thanks.

@rubenarslan

This comment has been minimized.

Copy link

rubenarslan commented Jun 2, 2016

I can do that but maybe I wasn't clear, I think this has nothing to do with
value labels, the write_sav example writes the all numeric mtcars dataset
and stilll crashes.
I did not update readstat manually on my local, should I have?
Do you still want me to try your suggestion?

@evanmiller

This comment has been minimized.

Copy link
Contributor

evanmiller commented Jun 2, 2016

@rubenarslan Ah OK I did not understand the full context. There is no need to try the suggestion then.

I am not sure what's going on -- it's possible some of the newer bits for defining the measure are causing a parse error. Please open a new issue.

@lock lock bot locked and limited conversation to collaborators Jun 27, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.