Repository: spack/spack

Issue:
sourceforge download filenames corrupted after #11117
Since merge of #11117, I cannot install libuuid:

```console
$ ./bin/spack install libuuid
==> Installing libuuid
==> Searching for binary cache of libuuid
==> Warning: No Spack mirrors are currently configured
==> No binary for libuuid found: installing from source
==> Fetching http://downloads.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibuuid%2F&ts=1433881396&use_mirror=iweb
######################################################################## 100.0%
==> Error: IOError: [Errno 2] No such file or directory: '/tmp/odoublewen/spack-stage/spack-stage-libuuid-1.0.3-i2o43zceswgaexd5xp6kghipbv3ey7uw/libuuid-1.0.3.tar.gz'

/home/odoublewen/git/odoublewen/spack/lib/spack/spack/package.py:1077, in do_fetch:
       1074
       1075        if checksum and self.version in self.versions:
       1076            self.stage.check()
  >>   1077
       1078        self.stage.cache_local()
       1079
       1080        for patch in self.spec.patches:
```

The download actually is working, but the filename in the filesystem contains all of the URL GET data.

```console
$ ls /tmp/odoublewen/spack-stage/spack-stage-libuuid-1.0.3-i2o43zceswgaexd5xp6kghipbv3ey7uw/
libuuid-1.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibuuid%2F&ts=1433881396&use_mirror=iweb
```

If I revert fd58c98, the download and install succeeds.

FYI @opadron



Discussion:
@odoublewen, I've added a note on what I think is the change that likely caused your issue:
https://github.com/spack/spack/pull/11117/files#r338288515

While we look into that, could you also post the output of `spack -d install libuuid`, both before and after fd58c98?  I'm particularly interested in the curl line that spack runs to do the download.
Happy to try to help.  I captured both stdout and stderr for both before and after fd58c98 (i.e. `spack -d install libuuid > before.txt 2>&1`)

Curiously, the curl command appears to be 100% identical!  I notice that in the `before.txt` log, the curl command is immediately followed by a tar command, which is using the "ugly" filename.  It succeeds because that IS the actual filename.  
```
==> [2019-10-23-14:49:34.175392] '/usr/bin/curl' '-C' '-' '-o' '/tmp/osolberg/spack-stage/spack-stage-libuuid-1.0.3-i2o43zceswgaexd5xp6kghipbv3ey7uw/libuuid-1.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibuuid%2F&ts=1433881396&use_mirror=iweb.part' '-f' '-D' '-' '-L' 'http://downloads.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibuuid%2F&ts=1433881396&use_mirror=iweb' '-sS'
==> [2019-10-23-14:49:34.916479] '/usr/bin/tar' '-xf' '/tmp/osolberg/spack-stage/spack-stage-libuuid-1.0.3-i2o43zceswgaexd5xp6kghipbv3ey7uw/libuuid-1.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibuuid%2F&ts=1433881396&use_mirror=iweb'
```

But in `after.txt` log, it never makes it to the tar command.  So it seems like the problem is that the tar command is getting a "sane" filename, which fails because the filename actually has the GET stuff?

Full logs attached.  Let me know if I can help further.

[after.txt](https://github.com/spack/spack/files/3764742/after.txt)
[before.txt](https://github.com/spack/spack/files/3764743/before.txt)


I think this is somewhat contained to `libuuid` (it affects packages with URLs that differ sufficiently from filename paths): see also: https://github.com/spack/spack/pull/11117/files#r338301058

I'm thinking this will get fixed today

Resolving patch:
diff --git a/lib/spack/spack/util/web.py b/lib/spack/spack/util/web.py
--- a/lib/spack/spack/util/web.py
+++ b/lib/spack/spack/util/web.py
@@ -203,14 +203,9 @@ def warn_no_ssl_cert_checking():
              "your Python to enable certificate verification.")
 
 
-def push_to_url(local_path, remote_path, **kwargs):
+def push_to_url(local_file_path, remote_path, **kwargs):
     keep_original = kwargs.get('keep_original', True)
 
-    local_url = url_util.parse(local_path)
-    local_file_path = url_util.local_file_path(local_url)
-    if local_file_path is None:
-        raise ValueError('local path must be a file:// url')
-
     remote_url = url_util.parse(remote_path)
     verify_ssl = spack.config.get('config:verify_ssl')
 


Test patch: