internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: mesonbuild/meson

Issue:
Native files crash with backend = 'vs2022' and warning_level = 'everything'
Hello !

**Describe the bug**
warning_level option accept a number or 'everything' on command line.
Native files provide the same options as command-line.
But if you put `warning_level = 'everything'` in a native file with backend = vs2022, meson crashes.

**To Reproduce**
```ps1
mkdir bug
cd bug
meson init
Add-Content -Path meson.ini -Encoding ascii -Value "[built-in options]"
Add-Content -Path meson.ini -Encoding ascii -Value "backend = 'vs2022'"
Add-Content -Path meson.ini -Encoding ascii -Value "warning_level = 'everything'"
meson setup build --native-file meson.ini
```

Error:
```
The Meson build system
Version: 1.3.0
Source dir: C:\Users\Julien\Desktop\Projets\bug
Build dir: C:\Users\Julien\Desktop\Projets\bug\build
Build type: native build
Project name: bug
Project version: 0.1
C compiler for the host machine: cl (msvc 19.38.33130 "Compilateur d'optimisation Microsoft (R) C/C++ version�19.38.33130 pour x64")
C linker for the host machine: link link 14.38.33130.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 1

bug 0.1

  User defined options
    Native files: meson.ini

Traceback (most recent call last):
  File "mesonbuild\mesonmain.py", line 194, in run
  File "mesonbuild\msetup.py", line 358, in run
  File "mesonbuild\msetup.py", line 181, in generate
  File "mesonbuild\msetup.py", line 251, in _generate
  File "mesonbuild\backend\vs2010backend.py", line 287, in generate
  File "mesonbuild\backend\vs2010backend.py", line 559, in generate_projects
  File "mesonbuild\backend\vs2010backend.py", line 1653, in gen_vcxproj
  File "mesonbuild\backend\vs2010backend.py", line 1370, in add_non_makefile_vcxproj_elements
ValueError: invalid literal for int() with base 10: 'everything'

ERROR: Unhandled python exception

    This is a Meson bug and should be reported!
```

**Expected behavior**
Should generate project, to be compiled with /Wall . 

**System parameters**
* Plain native build
* Windows 11
* Python 3.12.0
* Meson 1.3.0



Discussion:

Resolving patch:
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -1345,7 +1345,8 @@ def add_non_makefile_vcxproj_elements(
         ET.SubElement(clconf, 'FunctionLevelLinking').text = 'true'
         # Warning level
         warning_level = T.cast('str', target.get_option(OptionKey('warning_level')))
-        ET.SubElement(clconf, 'WarningLevel').text = 'Level' + str(1 + int(warning_level))
+        warning_level = 'EnableAllWarnings' if warning_level == 'everything' else 'Level' + str(1 + int(warning_level))
+        ET.SubElement(clconf, 'WarningLevel').text = warning_level
         if target.get_option(OptionKey('werror')):
             ET.SubElement(clconf, 'TreatWarningAsError').text = 'true'
         # Optimization flags


Test patch:
Repository: mesonbuild/meson

Issue:
buildtype=minsize won't minimize the binary with Visual Studio
**Describe the bug**
When you use `-Dbuildtype=minsize` (or `-Doptimization=s`) with `--backend=vs`, msvc will use `/O1 /Ot` for optimization.
like this
```
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\CL.exe /c /I
         "demo@exe" /I. /I..\ /I"demo@exe" /I. /I..\ /Zi /nologo /W2 /WX- /diagnostics:column /FS /O1 /Ot /D _MBCS /Gm-
          /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"demo@exe\main.c.obj" /Fd"demo@exe\vc143
         .pdb" /external:W2 /Gd /TC /FC /errorReport:queue /Gw ..\main.c
```

It means `/Os` will be overwritten by `/Ot`, I think?
When I added `/Os` to the options to overwrite `/Ot`, my app became smaller.

**To Reproduce**
```
meson setup builddir --backend=vs -Dbuildtype=minsize
meson compile -C builddir -v
```

**Expected behavior**
Remove `/Ot` from the compiler options when optimizing for size.

**system parameters**
* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)?
native build

* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
Windows 10

* what Python version are you using e.g. 3.8.0
Idk, I installed meson with the released msi.

* what `meson --version`
1.2.1

* what `ninja --version` if it's a Ninja build
not ninja build


Discussion:

Resolving patch:
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -1366,7 +1366,7 @@ def add_non_makefile_vcxproj_elements(
         elif '/Ob2' in o_flags:
             ET.SubElement(clconf, 'InlineFunctionExpansion').text = 'AnySuitable'
         # Size-preserving flags
-        if '/Os' in o_flags:
+        if '/Os' in o_flags or '/O1' in o_flags:
             ET.SubElement(clconf, 'FavorSizeOrSpeed').text = 'Size'
         # Note: setting FavorSizeOrSpeed with clang-cl conflicts with /Od and can make debugging difficult, so don't.
         elif '/Od' not in o_flags:


Test patch:
Repository: mesonbuild/meson

Issue:
Missing warning on use of `meson.add_dist_script()` with `meson_version: '>=0.40'`
**Describe the bug**

`meson setup build` does not seem to warn on use of `meson.add_dist_script()` with `meson_version: '>=0.40'`, even though `add_dist_script()` was only added in 0.48.0.

**To Reproduce**

```meson
project('no-warning', 'c',
  version : '0.1',
  meson_version : '>=0.40',
  default_options : ['warning_level=3'])

exe = executable('no-warning', 'no_warning.c',
  install : true)

test('basic', exe)

meson.add_dist_script('foo.sh')
```

```
touch foo.sh && chmod +x foo.sh
```

```
$ meson setup build --wipe
The Meson build system
Version: 1.3.1
Source dir: /tmp/no-warning
Build dir: /tmp/no-warning/build
Build type: native build
Project name: no-warning
Project version: 0.1
C compiler for the host machine: sccache cc (gcc 14.0.1 "cc (Gentoo Hardened 14.0.1_pre20240121 p16) 14.0.1 20240121 (experimental)")
C linker for the host machine: cc ld.bfd 2.41
Host machine cpu family: x86_64
Host machine cpu: x86_64
Build targets in project: 1

Found ninja-1.11.1 at /usr/bin/ninja
```

**Expected behavior**

A warning for use of `add_dist_script` as it may not be compatible with `meson-0.40`.

**system parameters**
* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? Native
* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Gentoo Linux
* what Python version are you using: 3.12.1
* what `meson --version`: 1.3.1



Discussion:

Resolving patch:
diff --git a/mesonbuild/interpreter/mesonmain.py b/mesonbuild/interpreter/mesonmain.py
--- a/mesonbuild/interpreter/mesonmain.py
+++ b/mesonbuild/interpreter/mesonmain.py
@@ -188,6 +188,7 @@ def add_postconf_script_method(
         varargs=(str, mesonlib.File, ExternalProgram)
     )
     @noKwargs
+    @FeatureNew('meson.add_dist_script', '0.48.0')
     def add_dist_script_method(
             self,
             args: T.Tuple[T.Union[str, mesonlib.File, ExternalProgram],


Test patch:
Repository: mesonbuild/meson

Issue:
coverage genhtml does not use .lcovrc
**Describe the bug**
When generating an HTML coverage report, the final call to genhtml does not use the .lcovrc config file. This causes genhtml-specific options to not be respected, such as the dark mode theme or css settings.

**To Reproduce**
1. Setup a build root with coverage support for a C++ project
    `meson setup build -Db_coverage=True`
2. Add a .lcovrc file at source root containing at least the following:
    `genhtml_dark_mode = 1`
3. Create an html coverage report using `ninja coverage-html`

**Expected behavior**
The generated HTML report has the dark theme.

**System parameters**
* No cross build
* OS: Gentoo Linux
* Python 3.12.0
* Meson 1.3.2
* Ninja 1.11.1

**Suggested fix**
```diff
--- a/mesonbuild/scripts/coverage.py    2024-02-15 16:51:46.193390219 +0100
+++ b/mesonbuild/scripts/coverage.py    2024-02-15 16:49:38.011725455 +0100
@@ -155,7 +155,7 @@
                                    '--legend',
                                    '--show-details',
                                    '--branch-coverage',
-                                   covinfo])
+                                   covinfo] + lcov_config)
             outfiles.append(('Html', pathlib.Path(htmloutdir, 'index.html')))
         elif gcovr_exe and mesonlib.version_compare(gcovr_version, '>=3.3'):
             htmloutdir = os.path.join(log_dir, 'coveragereport')
```



Discussion:
That sounds pretty reasonable. Can you submit the change as a pull request?

Resolving patch:
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py
--- a/mesonbuild/scripts/coverage.py
+++ b/mesonbuild/scripts/coverage.py
@@ -145,7 +145,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
                                    '--legend',
                                    '--show-details',
                                    '--branch-coverage',
-                                   covinfo])
+                                   covinfo] + lcov_config)
             outfiles.append(('Html', pathlib.Path(htmloutdir, 'index.html')))
         elif gcovr_exe and mesonlib.version_compare(gcovr_version, '>=3.3'):
             htmloutdir = os.path.join(log_dir, 'coveragereport')


Test patch:
Repository: easybuilders/easybuild-framework

Issue:
list of available toolchains is wrong if you try to build a non existent module
```
[jens@ca60c173]$ eb --software-name=Tcl -r
ERROR: EasyBuild crashed with an error (at easybuild/framework/easyconfig.py:724 in select_or_generate_ec): No toolchain name specified, and more than one available: ['goalf', 'ictce'].
[jens@ca60c173]$ eb --software-name=tcl -r
ERROR: EasyBuild crashed with an error (at easybuild/framework/easyconfig.py:724 in select_or_generate_ec): No toolchain name specified, and more than one available: ['TEMPLATE'].
```

It shows TEMPLATE instead of  ['goalf', 'ictce'].



Discussion:

Resolving patch:
diff --git a/easybuild/framework/easyconfig.py b/easybuild/framework/easyconfig.py
--- a/easybuild/framework/easyconfig.py
+++ b/easybuild/framework/easyconfig.py
@@ -714,6 +714,8 @@ def unique(l):
             # only one (non-template) toolchain availble, so use that
             tcname = tcnames[0]
             selected_tcname = tcname
+        elif len(tcnames) == 1 and tcnames[0] == "TEMPLATE":
+            selected_tcname = tcnames[0]
         else:
             # fall-back: use template toolchain if a toolchain name was specified
             if tcname:


Test patch:
Repository: easybuilders/easybuild-framework

Issue:
santiy_check_commands doesn't work for ipython



Discussion:

Resolving patch:
diff --git a/easybuild/framework/extensioneasyblock.py b/easybuild/framework/extensioneasyblock.py
--- a/easybuild/framework/extensioneasyblock.py
+++ b/easybuild/framework/extensioneasyblock.py
@@ -113,7 +113,7 @@ def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands
             # unload fake module and clean up
             self.clean_up_fake_module(fake_mod_data)
 
-        if custom_paths or custom_commands:
+        if custom_paths or self.cfg['sanity_check_paths'] or custom_commands or self.cfg['sanity_check_commands']:
             EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands,
                 extension=self.is_extension)
 


Test patch:
Repository: easybuilders/easybuild-framework

Issue:
improve integration with "lmod spider"
Hi,

currently I am using Lmod with eb and I have found that Lmod will print a detailed description of each module when running "module spider" if the module-whatis section in the module file starts with "Description:"

I will try to explain with more detail. This is the module-whatis section which is automatically generated by eb:

```
module-whatis {gzip (GNU zip) is a popular data compression program as a replacement for compress - Homepage: http://www.gnu.org/software/gzip/}
```

And this is the output of "module spider gzip"

```
  --------------------------------------
  gzip: gzip/1.5
  ----------------------------------------

    This module can be loaded directly: module load gzip/1.5
```

If I edit the module file to add just the word "Description" at the beggining of the module-whatis section like this:

```
module-whatis {Description: gzip (GNU zip) is a popular data compression program as a replacement for compress - Homepage: http://www.gnu.org/software/gzip/}
```

Then this is the output of "module spider gzip"

```
  --------------------------------
  gzip: gzip/1.5
  ----------------------------------
    Description:
      gzip (GNU zip) is a popular data compression program as a replacement for compress - Homepage: http://www.gnu.org/software/gzip/

    This module can be loaded directly: module load gzip/1.5
```

Add this would be a nice feature for lmod users and it seems quite easy. If I am not wrong only this line should be modified https://github.com/hpcugent/easybuild-framework/blob/master/easybuild/tools/module_generator.py#L123

If you have a few module files already generated you can fix them like this:

```
find /path/to/your/modules/folder -type f -iname "*" -exec sed -i -e 's/^module-whatis {/module-whatis {Description: /' {} \;
```



Discussion:

Resolving patch:
diff --git a/easybuild/tools/module_generator.py b/easybuild/tools/module_generator.py
--- a/easybuild/tools/module_generator.py
+++ b/easybuild/tools/module_generator.py
@@ -120,7 +120,7 @@ def get_description(self, conflict=True):
             "    }",
             "}",
             "",
-            "module-whatis {%(description)s}",
+            "module-whatis {Description: %(description)s}",
             "",
             "set root    %(installdir)s",
             "",


Test patch:
diff --git a/test/framework/module_generator.py b/test/framework/module_generator.py
--- a/test/framework/module_generator.py
+++ b/test/framework/module_generator.py
@@ -93,7 +93,7 @@ def test_descr(self):
             "    }",
             "}",
             "",
-            "module-whatis {%s}" % gzip_txt,
+            "module-whatis {Description: %s}" % gzip_txt,
             "",
             "set root    %s" % self.modgen.app.installdir,
             "",
Repository: easybuilders/easybuild-framework

Issue:
stand-alone scripts are not installed via setup.py, unit tests for them fail because of it



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@
 
 @author: Kenneth Hoste (Ghent University)
 """
-
+import glob
 import os
 from distutils import log
 
@@ -92,7 +92,7 @@ def find_rel_test():
     package_dir={'test.framework': "test/framework"},
     package_data={"test.framework": find_rel_test()},
     scripts=["eb", "optcomplete.bash", "minimal_bash_completion.bash"],
-    data_files=[],
+    data_files=[('easybuild/scripts', glob.glob('easybuild/scripts/*'))],
     long_description=read('README.rst'),
     classifiers=[
         "Development Status :: 5 - Production/Stable",


Test patch:
Repository: easybuilders/easybuild-framework

Issue:
Extension: wrong sources and patches default value
As a follow-up to https://github.com/hpcugent/easybuild-easyblocks/pull/717 the default value of `src` and `patches` instance variables in `Extension` should be an empty list and not `None`, so that it conforms to `EasyBlock`'s ones and allows iterating over without type-check.



Discussion:

Resolving patch:
diff --git a/easybuild/framework/extension.py b/easybuild/framework/extension.py
--- a/easybuild/framework/extension.py
+++ b/easybuild/framework/extension.py
@@ -57,8 +57,9 @@ def __init__(self, mself, ext):
         if not 'name' in self.ext:
             raise EasyBuildError("'name' is missing in supplied class instance 'ext'.")
 
-        self.src = self.ext.get('src', None)
-        self.patches = self.ext.get('patches', None)
+        # list of source/patch files: we use an empty list as default value like in EasyBlock
+        self.src = self.ext.get('src', [])
+        self.patches = self.ext.get('patches', [])
         self.options = copy.deepcopy(self.ext.get('options', {}))
 
         self.toolchain.prepare(self.cfg['onlytcmod'])


Test patch:
Repository: easybuilders/easybuild-framework

Issue:
packaging fails when homepage = '(none)'
I just found that packaging fails with some easyconfigs which have `homepage = '(none)'`. As example this one fails
https://github.com/hpcugent/easybuild-easyconfigs/blob/master/easybuild/easyconfigs/g/goolf/goolf-1.7.20.eb

Here you have a debug log:
https://gist.github.com/02ce3baf6fe8afbc46ce

As temporary workaround I just defined a homepage for this toolchain using url http://easybuild.readthedocs.org/en/latest/eb_list_toolchains.html

Maybe the proper solution is to check the content of the `homepage` variable and skip using it in case it's not valid? 

CC: @rjeschmi 



Discussion:
Yeah I already caught this. It is a problem with escaping properly.

On Mon, Dec 28, 2015, 10:20 AM Pablo Escobar Lopez notifications@github.com
wrote:

> I just found that packaging fails with some easyconfigs which have homepage
> = '(none)' As example this one fails
> 
> https://githubcom/hpcugent/easybuild-easyconfigs/blob/master/easybuild/easyconfigs/g/goolf/goolf-1720eb
> 
> Here you have a debug log:
> https://gistgithubcom/02ce3baf6fe8afbc46ce
> 
> As temporary workaround I just defined a homepage for this toolchain using
> url http://easybuildreadthedocsorg/en/latest/eb_list_toolchainshtml
> 
> Maybe the proper solution is to check the content of the homepage
> variable and skip using it in case it's not valid?
> 
> CC: @rjeschmi https://github.com/rjeschmi
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/hpcugent/easybuild-framework/issues/1527.

hmm I can't find my fix, but it is trivial, so I'll patch again and test.


Resolving patch:
diff --git a/easybuild/tools/package/utilities.py b/easybuild/tools/package/utilities.py
--- a/easybuild/tools/package/utilities.py
+++ b/easybuild/tools/package/utilities.py
@@ -108,19 +108,19 @@ def package_with_fpm(easyblock):
     for dep in deps:
         _log.debug("The dep added looks like %s ", dep)
         dep_pkgname = package_naming_scheme.name(dep)
-        depstring += " --depends '%s'" % dep_pkgname
+        depstring += " --depends %s" % quote_str(dep_pkgname)
 
     cmdlist = [
         PKG_TOOL_FPM,
         '--workdir', workdir,
-        '--name', pkgname,
-        '--provides', pkgname,
+        '--name', quote_str(pkgname),
+        '--provides', quote_str(pkgname),
         '-t', pkgtype,  # target
         '-s', 'dir',  # source
         '--version', pkgver,
         '--iteration', pkgrel,
         '--description', quote_str(easyblock.cfg["description"]),
-        '--url', easyblock.cfg["homepage"],
+        '--url', quote_str(easyblock.cfg["homepage"]),
         depstring,
         easyblock.installdir,
         easyblock.module_generator.get_module_filepath(),


Test patch:
Repository: easybuilders/easybuild-framework

Issue:
`--new-pr` should refuse to open empty PR.



Discussion:
`--new-pr` should refuse to open empty PRs. If no files (or maybe) changed files are going to committed, then eb should refuse to open it. 


Resolving patch:
diff --git a/easybuild/tools/github.py b/easybuild/tools/github.py
--- a/easybuild/tools/github.py
+++ b/easybuild/tools/github.py
@@ -618,6 +618,9 @@ def _easyconfigs_pr_common(paths, start_branch=None, pr_branch=None, target_acco
         print_msg(git_repo.git.diff(cached=True) + '\n', log=_log, prefix=False)
 
     diff_stat = git_repo.git.diff(cached=True, stat=True)
+    if not diff_stat:
+        raise EasyBuildError("No changed files found when comparing to current develop branch."
+                             "Refused to make empty pull request.")
 
     # commit
     if commit_msg:


Test patch:
diff --git a/test/framework/options.py b/test/framework/options.py
--- a/test/framework/options.py
+++ b/test/framework/options.py
@@ -47,7 +47,8 @@
 from easybuild.tools.config import DEFAULT_MODULECLASSES
 from easybuild.tools.config import find_last_log, get_build_log_path, get_module_syntax, module_classes
 from easybuild.tools.environment import modify_env
-from easybuild.tools.filetools import mkdir, read_file, write_file
+from easybuild.tools.filetools import download_file, mkdir, read_file, write_file
+from easybuild.tools.github import GITHUB_RAW, GITHUB_EB_MAIN, GITHUB_EASYCONFIGS_REPO, URL_SEPARATOR
 from easybuild.tools.github import fetch_github_token
 from easybuild.tools.options import EasyBuildOptions, parse_external_modules_metadata, set_tmpdir
 from easybuild.tools.toolchain.utilities import TC_CONST_PREFIX
@@ -2350,6 +2351,33 @@ def test_new_update_pr(self):
             regex = re.compile(regex, re.M)
             self.assertTrue(regex.search(txt), "Pattern '%s' found in: %s" % (regex.pattern, txt))
 
+    def test_empty_pr(self):
+        """Test use of --new-pr (dry run only) with no changes"""
+        if self.github_token is None:
+            print "Skipping test_empty_pr, no GitHub token available?"
+            return
+
+        # get file from develop branch
+        full_url = URL_SEPARATOR.join([GITHUB_RAW, GITHUB_EB_MAIN, GITHUB_EASYCONFIGS_REPO,
+                                       'develop/easybuild/easyconfigs/z/zlib/zlib-1.2.8.eb'])
+        ec_fn = os.path.basename(full_url)
+        ec = download_file(ec_fn, full_url, path=os.path.join(self.test_prefix, ec_fn))
+
+        # try to open new pr with unchanged file
+        args = [
+            '--new-pr',
+            '--experimental',
+            ec,
+            '-D',
+            '--github-user=%s' % GITHUB_TEST_ACCOUNT,
+        ]
+
+        self.mock_stdout(True)
+        error_msg = "No changed files found when comparing to current develop branch."
+        self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, do_build=True, raise_error=True)
+        self.mock_stdout(False)
+
+
     def test_show_config(self):
         """"Test --show-config and --show-full-config."""