Skip to content
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

stage-1: fix typo that breaks resume #9056

Merged
merged 1 commit into from
Jul 30, 2015
Merged

stage-1: fix typo that breaks resume #9056

merged 1 commit into from
Jul 30, 2015

Conversation

spencerjanssen
Copy link
Contributor

$d should be $sd, this causes resume from hibernate to fail if
resumeDevice is not explicitly set in config. Introduced in commit:
'stage-1: Shut up warnings about swap devices that don't exist yet'

Resume stopped working after a recent update, and this commit fixes it for me. I tested this against current nixos-unstable, but I have not tested the change after rebasing on master.

$d should be $sd, this causes resume from hibernate to fail if
resumeDevice is not explicitly set in config.  Introduced in commit:
'stage-1: Shut up warnings about swap devices that don't exist yet'
edolstra added a commit that referenced this pull request Jul 30, 2015
stage-1: fix typo that breaks resume
@edolstra edolstra merged commit 958de05 into NixOS:master Jul 30, 2015
@vcunat
Copy link
Member

vcunat commented Jul 31, 2015

Ah, this is why resume didn't work for me on the systemd-219 branch. Picked it back 026c31d.

@copumpkin
Copy link
Member

What would a VM test for this look like? Do we have some way to simulate a resume in qemu?

@vcunat
Copy link
Member

vcunat commented Jul 31, 2015

It would be nice to have a typo-resilient language for such "scripts" (i. e. with static type checking).

@lucabrunox
Copy link
Contributor

@vcunat yeah except it doesn't exist... e.g. you might still write getenv("fooz") instead of getenv("foo"), type checking won't save you.

@vcunat
Copy link
Member

vcunat commented Jul 31, 2015

The need for outside-environment variables is rather rare – I see mostly need for local bindings (such as this mistyped iterator). The truth is I don't know about a suitable language+library for these kind of things.

@lucabrunox
Copy link
Contributor

@vcunat so you have two ints, a and b, and you mistype one for the other :P

@copumpkin
Copy link
Member

The fact that types don't catch everything isn't an argument against using
them. Further, most decent type systems allow you to construct more
interesting types than Int that carry more significant semantics, so that
you don't have to go using unadorned machine representations as parameters
to your functions, but can actually pass in actually meaningful values.

On Fri, Jul 31, 2015 at 10:03 AM, lethalman [email protected]
wrote:

@vcunat https://github.com/vcunat so you have two ints, a and b, and
you mistype one for the other.


Reply to this email directly or view it on GitHub
#9056 (comment).

@edolstra
Copy link
Member

@vcunat Well, we can rewrite the stage-1 script in Perl :-)

@vcunat
Copy link
Member

vcunat commented Jul 31, 2015

@lethalman: mistyping into something that is defined is much less likely, especially when one minimizes scope sizes, and adding a strong type-checking would decrease the probability even more.

Perl doesn't sound as a significant enough improvement in terms of finding errors before running, but maybe it's just because I know too little about it (or about a suitable lint-like tool for it).

@edolstra
Copy link
Member

Perl (unlike Python) does actually complain about undefined variables, so it would have caught this error. Regarding better type checking, there are probably not that many options, given that the language interpreter has to fit inside an initrd... (Unless of course we'd want to go for a compiled language.)

@copumpkin
Copy link
Member

For now I'd just settle for a test 😄

@vcunat
Copy link
Member

vcunat commented Jul 31, 2015

(I'm sorry most of this thread is off topic.) I think we could have compilation for such things, as we don't allow in-place modification anyway. To stay conservative, we might still leave the source along each executable. But even then I don't see a clear choice of language.

@copumpkin
Copy link
Member

To stay conservative, we might still leave the source along each executable.

cough NixOS/nix#553

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

Successfully merging this pull request may close these issues.

5 participants