Repository: spack/spack

Issue:
Installation issue: gcc
<!-- Thanks for taking the time to report this build failure. To proceed with the report please:

1. Title the issue "Installation issue: gcc".
2. Provide the information required below.

We encourage you to try, as much as possible, to reduce your problem to the minimal example that still reproduces the issue. That would help us a lot in fixing it quickly and effectively! -->

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install gcc@master
...
==> No binary for gcc found: installing from source                                                                                               [190/630]
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
2 out of 2 hunks ignored -- saving rejects to file gcc/Makefile.in.rej
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file gcc/configure.ac.rej
==> Patch /lustre/home/ca-tgreen/Work/git/spack/var/spack/repos/builtin/packages/gcc/zstd.patch failed.
==> Error: ProcessError: Command exited with status 1:
    '/usr/bin/patch' '-s' '-p' '1' '-i' '/lustre/home/ca-tgreen/Work/git/spack/var/spack/repos/builtin/packages/gcc/zstd.patch' '-d' '.'

```

### Information on your system

<!-- Please include the output of `spack debug report` -->
* **Spack:** 0.15.4-979-ee1725828
* **Python:** 3.6.8
* **Platform:** cray-rhel8-aarch64


<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

<!-- Please upload the following files. They should be present in the stage directory of the failing build. Also upload any config.log or similar file if one exists. -->
* [spack-build-out.txt]()
* [spack-build-env.txt]()
Not present in staging directory.

<!-- Some packages have maintainers who have volunteered to debug build failures. Run `spack maintainers <name-of-the-package>` and @mention them here if they exist. -->

@michaelkuhn 

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [x] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [ ] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate




Discussion:
Had temporary fix by fixing the version that the ztd patch is applied in gcc package.py since the master version of gcc has the patch already applied.
@tomgreen66 that sounds like the right fix to me if you want to submit a PR to fix this. Just use:
```python
patch('zstd.patch', when='@10.0:10.2')
```
assuming that it won't be needed in 10.3.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -270,7 +270,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
     patch('sys_ustat-4.9.patch', when='@4.9')
 
     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005
-    patch('zstd.patch', when='@10:')
+    patch('zstd.patch', when='@10.0:10.2')
 
     build_directory = 'spack-build'
 


Test patch: