Hi all,

The Nixpkgs Manual mentions that stdenv provides a shell function,
stripHash, that will strip off the directory and hash part of a store path,
and print out just the name. (See
http://nixos.org/nixpkgs/manual/#fun-stripHash).

However, it doesn't actually print anything out. (At least not in my
environment--nixpkgs from the unstable channel, recently updated). Digging
further:

[nix-shell:/tmp/build]$ type stripHash
stripHash is a function
stripHash ()
{
    strippedName=$(basename $1);
    if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
        strippedName=$(echo "$strippedName" | cut -c34-);
    fi
}

It seems that it's correctly stripping off the name, but not echoing it as
the manual suggests. And sure enough, poking around in builder scripts in
nixpkgs, there are lots of uses of stripHash that follow this pattern:

$(stripHash $foo; echo $strippedName)

Is this a bug that everybody just works around, or is it the desired
behaviour?

Colin
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to