Skip to content

Antiquotes silently fail #1017

Closed as not planned
Closed as not planned

Description

@ttuegel

See NixOS/nixpkgs#17595. An antiquote of the form

'' ${LINK:0:1} ''

substitutes the string LINK:0:1 into the builder, instead of failing because this is not valid Nix syntax.

Activity

  1. abbradar commented on Aug 8, 2016

    @abbradar
    Member

    I wonder just how many evaluation errors we'd catch when this is fixed...

  2. edolstra commented on Aug 8, 2016

    @edolstra
    Member

    It is in fact valid Nix syntax, since link:0:1 is parsed as a URI.

  3. abbradar commented on Aug 8, 2016

    @abbradar
    Member
     nixpkgs git:(master) ✗ egrep --include=\*.nix -r "[^'\\]\\\${[a-zA-Z0-9]+:"
    nixos/modules/system/boot/stage-1.nix:            if [ "${LINK:0:1}" != "/" ]; then
    pkgs/development/tools/misc/hydra/default.nix:    export LOGNAME=${LOGNAME:-foo}
    pkgs/servers/amqp/rabbitmq-server/default.nix:      echo 'PATH=${erlang}/bin:${PATH:+:}$PATH' >> $out/sbin/rabbitmq-env
    
  4. ttuegel commented on Aug 8, 2016

    @ttuegel
    MemberAuthor

    😱 😱 🙀

    @abbradar Wow, your regex-fu... Much respect.

  5. abbradar commented on Aug 8, 2016

    @abbradar
    Member

    @ttuegel I won't be able to parse it myself in I think 15 minutes ~_^.

    Seems an ugly situation without an obvious solution -- enough to tempt me to add some scream smileys to the row. Any ideas?

  6. ttuegel commented on Aug 8, 2016

    @ttuegel
    MemberAuthor

    I would say, fix all the occurrences in Nixpkgs and add a linting pass to Travis CI.

  7. added a commit that references this issue on Aug 8, 2016
  8. abbradar commented on Aug 8, 2016

    @abbradar
    Member

    First part done: NixOS/nixpkgs@3fca2ce (at least those that I could catch with the regexp -- it's not ideal).

  9. ttuegel commented on Aug 8, 2016

    @ttuegel
    MemberAuthor

    The only other thing I can think of is disallowing literals from antiquotes. The only valid reason to use a literal that I can think of is to copy an in-tree path to the store. That would definitely be the "scorched earth" approach, though.

  10. abbradar commented on Aug 8, 2016

    @abbradar
    Member

    We can just disallow URLs in them -- but I'm not sure it could be done easily in Nix (I imagine they are converted to just strings in the parser). If paths are parsed differently however we can disallow strings in antiquotes entirely (I don't know a good usecase for ${"blah"}).

    EDIT: to clarify, I propose to have this test before any reduction, so ${makeLibraryPath [foo]} should be fine.

  11. copumpkin commented on Aug 8, 2016

    @copumpkin
    Member

    #836 (comment)

    I'm still not sure I buy the value of having special complex URI syntax over writing two extra quote characters for URLs.

  12. copumpkin commented on Aug 8, 2016

    @copumpkin
    Member

    Also note that @vcunat knew about this issue 😄 #836 (comment)

  13. abbradar commented on Aug 8, 2016

    @abbradar
    Member

    IIUC @vcunat was not talking about this issue, but about absence of antiquotes in URLs (http://foo/${bar}).

    I happen to agree that URI syntax is too much pain with parsing, tooling and issues like this for too little gain.

    Nikolay.

  14. vcunat commented on Aug 9, 2016

    @vcunat
    Member

    Abbradar is correct in what I meant.

    The non-URL URI literals really do seem to be confusing to most people and I don't know of any use case for them.

  15. fkz commented on Aug 9, 2016

    @fkz
    Contributor

    It would be pretty easy to disallow uri syntax inside ${ ... } blocks. I don't see much value in them there.
    On the other hand adding special cases doesn't make learning nix easier

  16. 2 remaining items

  17. added a commit that references this issue on Aug 9, 2016
    141d131
  18. fkz commented on Aug 9, 2016

    @fkz
    Contributor

    done

  19. domenkozar commented on Oct 28, 2016

    @domenkozar
    Member

    Another instance of this NixOS/nixpkgs#19939

  20. groxxda commented on Oct 28, 2016

    @groxxda
    Contributor

    I vote for dropping native uri parsing since it does not support the full rfc anyway: Two valid uris that are not recognized: http://[::1] and http://localhost/name;with;semicolons

  21. stale commented on Feb 15, 2021

    @stale

    I marked this as stale due to inactivity. → More info

  22. stale commented on May 2, 2022

    @stale

    I closed this issue due to inactivity. → More info

  23. tomberek commented on Aug 13, 2026

    @tomberek
    Contributor

    Closing as stale. Re-open if needed.

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions