internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: archlinux/archinstall

Issue:
For some reason, it wants to make a crub.cfg in /boot/efi. This fails
Here is the log file.

[H51g.log](https://github.com/archlinux/archinstall/files/14378267/H51g.log)



Discussion:
Please rename this to "Could not configure GRUB".

Resolving patch:
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -919,12 +919,7 @@ def _add_grub_bootloader(
 
 		info(f"GRUB boot partition: {boot_partition.dev_path}")
 
-		if boot_partition == root_partition and root_partition.mountpoint:
-			boot_dir = root_partition.mountpoint / 'boot'
-		elif boot_partition.mountpoint:
-			boot_dir = boot_partition.mountpoint
-		else:
-			raise ValueError('Could not detect boot directory')
+		boot_dir = Path('/boot')
 
 		command = [
 			'/usr/bin/arch-chroot',
@@ -942,8 +937,9 @@ def _add_grub_bootloader(
 			self.pacman.strap('efibootmgr') # TODO: Do we need? Yes, but remove from minimal_installation() instead?
 
 			boot_dir_arg = []
-			if boot_partition != efi_partition:
-				boot_dir_arg.append(f'--boot-directory={boot_dir}')
+			if boot_partition.mountpoint and boot_partition.mountpoint != boot_dir:
+				boot_dir_arg.append(f'--boot-directory={boot_partition.mountpoint}')
+				boot_dir = boot_partition.mountpoint
 
 			add_options = [
 				'--target=x86_64-efi',


Test patch:
Repository: archlinux/archinstall

Issue:
Manual Partitioning failed on b8052c5
Manual Partitioning failed on b8052c5.
[install.log](https://github.com/archlinux/archinstall/files/15139144/install.log)

There is no problem on v2.8.0.


Discussion:
How did you run archinstall?
Are you saying that the latest 2.8.0 is working fine? 
> How did you run archinstall? Are you saying that the latest 2.8.0 is working fine?

I tested them first on the installed Arch Linux.
archinstall-git crashed, archinstall-2.8.0 works fine.
I thought "Maybe archinstall-git can't manage the mounted system partition", so I tested them from USB stick.

Boot EndeavourOS from USB stick.
(I always run archinstall on XFCE or KDE Plasma. Linux Console can't show Japanese characters properly.)
Run Konsole.

## archinstall-git

```
yay -Syy
yay -S --needed python-build python-packaging python-sphinx_rtd_theme 
yay -S archinstall-git
sudo archinstall
```

[archinstall-git.webm](https://github.com/archlinux/archinstall/assets/34818411/2c768e3d-2057-4cdb-84ae-3c7e7a482593)

## archinstall-2.8.0

```
yay -S archinstall
sudo archinstall
```

[archinstall-2.8.0.webm](https://github.com/archlinux/archinstall/assets/34818411/f8f13082-c774-42d3-907f-77b980fbac36)

Resolving patch:
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -669,10 +669,6 @@ class PartitionModification:
 	flags: List[PartitionFlag] = field(default_factory=list)
 	btrfs_subvols: List[SubvolumeModification] = field(default_factory=list)
 
-	# only set when modification was created from an existing
-	# partition info object to be able to reference it back
-	part_info: Optional[_PartitionInfo] = None
-
 	# only set if the device was created or exists
 	dev_path: Optional[Path] = None
 	partn: Optional[int] = None
@@ -743,8 +739,7 @@ def from_existing_partition(cls, partition_info: _PartitionInfo) -> PartitionMod
 			uuid=partition_info.uuid,
 			flags=partition_info.flags,
 			mountpoint=mountpoint,
-			btrfs_subvols=subvol_mods,
-			part_info=partition_info
+			btrfs_subvols=subvol_mods
 		)
 
 	@property


Test patch:
Repository: archlinux/archinstall

Issue:
Root partition should be "Linux root"
Small nitpick, but the root partition should be "Linux root" instead of "Linux filesystem" for systems without /etc/fstab.

https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks#Creating_the_root_partition
https://www.freedesktop.org/software/systemd/man/latest/systemd-gpt-auto-generator.html
https://wiki.archlinux.org/title/partitioning#/


Discussion:

Resolving patch:
diff --git a/archinstall/lib/disk/device_handler.py b/archinstall/lib/disk/device_handler.py
--- a/archinstall/lib/disk/device_handler.py
+++ b/archinstall/lib/disk/device_handler.py
@@ -4,6 +4,7 @@
 import os
 import logging
 import time
+import uuid
 from pathlib import Path
 from typing import List, Dict, Any, Optional, TYPE_CHECKING, Literal, Iterable
 
@@ -499,6 +500,10 @@ def _setup_partition(
 		except PartitionException as ex:
 			raise DiskError(f'Unable to add partition, most likely due to overlapping sectors: {ex}') from ex
 
+		if disk.type == PartitionTable.GPT.value and part_mod.is_root():
+			linux_root_x86_64 = "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709"
+			partition.type_uuid = uuid.UUID(linux_root_x86_64).bytes
+
 		# the partition has a path now that it has been added
 		part_mod.dev_path = Path(partition.path)
 


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
eu-central-1 missing for availability zones check



Discussion:

Resolving patch:
diff --git a/src/cfnlint/helpers.py b/src/cfnlint/helpers.py
--- a/src/cfnlint/helpers.py
+++ b/src/cfnlint/helpers.py
@@ -48,6 +48,7 @@
     'eu-west-1a', 'eu-west-1b', 'eu-west-1c',
     'eu-west-2a', 'eu-west-2b', 'eu-west-2c',
     'eu-west-3a', 'eu-west-3b', 'eu-west-3c',
+    'eu-central-1a', 'eu-central-1b', 'eu-central-1c',
     'eu-central-2a', 'eu-central-2b', 'eu-central-2c',
     'ap-northeast-1a', 'ap-northeast-1b', 'ap-northeast-1c', 'ap-northeast-1d',
     'ap-northeast-2a', 'ap-northeast-2b',


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
Adding new CloudFormationLintRule's requires the filename to be identical to the Class name
*cfn-lint version: (`cfn-lint --version`)*
0.0.9

*Description of issue.*

When creating your own rules, you have to add  CloudFormationLintRules, but the loader requires
the python filename to be identical to the Classname.

It would be nice if:
- we can create files with names matching the python convention.
- we could add multiple lint rules in a single module.



Discussion:

Resolving patch:
diff --git a/src/cfnlint/helpers.py b/src/cfnlint/helpers.py
--- a/src/cfnlint/helpers.py
+++ b/src/cfnlint/helpers.py
@@ -21,6 +21,7 @@
 import imp
 import logging
 import re
+import inspect
 import pkg_resources
 
 
@@ -189,8 +190,12 @@ def load_plugins(directory):
             try:
                 fh, filename, desc = imp.find_module(pluginname, [root])
                 mod = imp.load_module(pluginname, fh, filename, desc)
-                obj = getattr(mod, pluginname)()
-                result.append(obj)
+                for _, clazz in inspect.getmembers(mod, inspect.isclass):
+                    method_resolution = inspect.getmro(clazz)
+                    if [clz for clz in method_resolution[1:] if clz.__module__ == 'cfnlint' and clz.__name__ == 'CloudFormationLintRule']:
+                        # create and instance of subclasses of CloudFormationLintRule
+                        obj = clazz()
+                        result.append(obj)
             finally:
                 if fh:
                     fh.close()


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
method to load yaml from a string
*cfn-lint version: cfn-lint 0.4.2*

*Description of issue.*

When consuming cfn-lint as a module there is currently only an interface to load yaml from a file(`cfnlint.core.decode.cfn_yaml.load`). In our project([taskcat](https://github.com/aws-quickstart/taskcat/)) we have a need to load templates from strings as well. 

While we could just do something like below, think it would be useful to others to have a simpler interface for yaml strings:

```python
from cfnlint.decode.cfn_yaml import MarkedLoader, multi_constructor
loader = MarkedLoader(my_yaml_string, None)
loader.add_multi_constructor('!', multi_constructor)
template = loader.get_single_data()
```



Discussion:
Agree, something like cfnlint.core.decode.cfn_yaml.loads would be a nice add 

Resolving patch:
diff --git a/src/cfnlint/decode/cfn_yaml.py b/src/cfnlint/decode/cfn_yaml.py
--- a/src/cfnlint/decode/cfn_yaml.py
+++ b/src/cfnlint/decode/cfn_yaml.py
@@ -177,12 +177,11 @@ def construct_getatt(node):
     raise ValueError('Unexpected node type: {}'.format(type(node.value)))
 
 
-def load(filename):
+def loads(yaml_string, fname=None):
     """
-    Load the give YAML file
+    Load the given YAML string
     """
-    fp = open(filename)
-    loader = MarkedLoader(fp.read(), filename)
+    loader = MarkedLoader(yaml_string, fname)
     loader.add_multi_constructor('!', multi_constructor)
     template = loader.get_single_data()
     # Convert an empty file to an empty dict
@@ -190,3 +189,11 @@ def load(filename):
         template = {}
 
     return template
+
+
+def load(filename):
+    """
+    Load the given YAML file
+    """
+    fp = open(filename)
+    return loads(fp.read(), filename)


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
E2502 is mistaken about IamInstanceProfile
*cfn-lint version: 0.4.2*

*Description of issue.*

Linting a template returned:
```
E2502 Property IamInstanceProfile shouldn't be an ARN for Resources/BuildkiteSpotfleet/Properties/SpotFleetRequestConfigData/LaunchSpecifications/0/IamInstanceProfile/Arn/Fn::GetAtt
```

However that property can be an ARN according to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-iaminstanceprofile

It can be an `{"Arn": "profile_arn"}` structure.


Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/iam/InstanceProfile.py b/src/cfnlint/rules/resources/iam/InstanceProfile.py
--- a/src/cfnlint/rules/resources/iam/InstanceProfile.py
+++ b/src/cfnlint/rules/resources/iam/InstanceProfile.py
@@ -48,10 +48,16 @@ def match(self, cfn):
                             '/'.join(map(str, tree[:-1])))
                         matches.append(RuleMatch(tree[:-1], message))
                     else:
-                        if obj[1] == 'Arn':
-                            message = 'Property IamInstanceProfile shouldn\'t be an ARN for %s' % (
-                                '/'.join(map(str, tree[:-1])))
-                            matches.append(RuleMatch(tree[:-1], message))
+                        if cfn.template.get('Resources', {}).get(tree[1], {}).get('Type') in ['AWS::EC2::SpotFleet']:
+                            if obj[1] != 'Arn':
+                                message = 'Property IamInstanceProfile should be an ARN for %s' % (
+                                    '/'.join(map(str, tree[:-1])))
+                                matches.append(RuleMatch(tree[:-1], message))
+                        else:
+                            if obj[1] == 'Arn':
+                                message = 'Property IamInstanceProfile shouldn\'t be an ARN for %s' % (
+                                    '/'.join(map(str, tree[:-1])))
+                                matches.append(RuleMatch(tree[:-1], message))
 
         # Search Refs
         trees = cfn.search_deep_keys('Ref')


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
Fn::Cidr should support Fn::GetAtt (E1024)
* cfn-lint 0.6.1
* I get the following error: 

```
E1024 Cidr ipBlock should be Cidr Range, Ref, or Select for Resources/MySubnet/Properties/CidrBlock/Fn::Select/1/Fn::Cidr/0/template.yml:123:7
```
```
Resources:
  MySubnet:
    Properties:
      CidrBlock: !Select
        - 0
        - !Cidr
          - !GetAtt 'MyVPC.CidrBlock'
          - 16
          - 8
```

Although the documentation doesn't mention the Fn::GetAtt in the list of supported functions, it is used in the CloudFormation examples on the same page. 

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-cidr.html



Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/functions/Cidr.py b/src/cfnlint/rules/functions/Cidr.py
--- a/src/cfnlint/rules/functions/Cidr.py
+++ b/src/cfnlint/rules/functions/Cidr.py
@@ -91,6 +91,7 @@ def match(self, cfn):
         supported_functions = [
             'Fn::Select',
             'Ref',
+            'Fn::GetAtt',
             'Fn::ImportValue'
         ]
 
@@ -113,7 +114,7 @@ def match(self, cfn):
                         if len(ip_block_obj) == 1:
                             for index_key, _ in ip_block_obj.items():
                                 if index_key not in supported_functions:
-                                    message = 'Cidr ipBlock should be Cidr Range, Ref, or Select for {0}'
+                                    message = 'Cidr ipBlock should be Cidr Range, Ref, GetAtt, or Select for {0}'
                                     matches.append(RuleMatch(
                                         tree[:] + [0], message.format('/'.join(map(str, tree[:] + [0])))))
                     elif isinstance(ip_block_obj, (six.text_type, six.string_types)):


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
--append-rules doesn't report if directory doesn't exist
*cfn-lint version: (`cfn-lint --version`)* 0.7.1

*Description of issue.*

`cfn-lint --append-rules nonexistent --region us-east-1 --template template.yml` doesn't fail, thus a typo can make a lint command silently pass. The existence of every directory passed in `--append-rules` should be verified.


Discussion:

Resolving patch:
diff --git a/src/cfnlint/core.py b/src/cfnlint/core.py
--- a/src/cfnlint/core.py
+++ b/src/cfnlint/core.py
@@ -181,9 +181,13 @@ def get_rules(rulesdir, ignore_rules):
     """Get rules"""
     rules = RulesCollection(ignore_rules)
     rules_dirs = [DEFAULT_RULESDIR] + rulesdir
-    for rules_dir in rules_dirs:
-        rules.extend(
-            RulesCollection.create_from_directory(rules_dir))
+    try:
+        for rules_dir in rules_dirs:
+            rules.extend(
+                RulesCollection.create_from_directory(rules_dir))
+    except OSError as e:
+        LOGGER.error('Tried to append rules but got an error: %s', str(e))
+        exit(1)
 
     return rules
 
diff --git a/src/cfnlint/helpers.py b/src/cfnlint/helpers.py
--- a/src/cfnlint/helpers.py
+++ b/src/cfnlint/helpers.py
@@ -188,7 +188,11 @@ def load_plugins(directory):
     result = []
     fh = None
 
-    for root, _, filenames in os.walk(directory):
+    def onerror(os_error):
+        """Raise an error"""
+        raise os_error
+
+    for root, _, filenames in os.walk(directory, onerror=onerror):
         for filename in fnmatch.filter(filenames, '[A-Za-z]*.py'):
             pluginname = filename.replace('.py', '')
             try:
@@ -203,6 +207,7 @@ def load_plugins(directory):
             finally:
                 if fh:
                     fh.close()
+
     return result
 
 


Test patch:
Repository: aws-cloudformation/cfn-lint

Issue:
${aws:username} now fails
*cfn-lint version: 0.8

E1029 Found an embedded parameter outside of an "Fn::Sub" at Resources/ForceMFAPolicy/Properties/PolicyDocument/Statement/3/Resource/0/arn:aws:iam::*:mfa/${aws:username}

It looks like the IAM variables are now being detected as embedded parameters in cfn-lint.

            Effect: "Allow"
            Action:
              - "iam:UploadSSHPublicKey"
            Resource: "arn:aws:iam::*:user/${aws:username}"


Discussion:
Looking into it.  This will need a fix. 

Resolving patch:
diff --git a/src/cfnlint/rules/functions/SubNeeded.py b/src/cfnlint/rules/functions/SubNeeded.py
--- a/src/cfnlint/rules/functions/SubNeeded.py
+++ b/src/cfnlint/rules/functions/SubNeeded.py
@@ -27,7 +27,7 @@ class SubNeeded(CloudFormationLintRule):
     tags = ['functions', 'sub']
 
     # Free-form text properties to exclude from this rule
-    excludes = ['UserData', 'ZipFile']
+    excludes = ['UserData', 'ZipFile', 'Resource', 'Condition']
 
     def _match_values(self, searchRegex, cfnelem, path):
         """Recursively search for values matching the searchRegex"""


Test patch:
diff --git a/test/fixtures/templates/good/functions/sub_needed.yaml b/test/fixtures/templates/good/functions/sub_needed.yaml
new file mode 100644
--- /dev/null
+++ b/test/fixtures/templates/good/functions/sub_needed.yaml
@@ -0,0 +1,20 @@
+---
+AWSTemplateFormatVersion: "2010-09-09"
+Parameters:
+  AMIId:
+    Type: 'String'
+    Description: 'The AMI ID for the image to use.'
+Resources:
+  myPolicy:
+    Type: AWS::IAM::Policy
+    Properties:
+      Roles:
+      - testRole
+      PolicyName: test
+      PolicyDocument:
+        Version: "2012-10-17"
+        Statement:
+        - Effect: "Allow"
+          Action:
+            - "iam:UploadSSHPublicKey"
+          Resource: "arn:aws:iam::*:user/${aws:username}"
diff --git a/test/rules/functions/test_sub_needed.py b/test/rules/functions/test_sub_needed.py
--- a/test/rules/functions/test_sub_needed.py
+++ b/test/rules/functions/test_sub_needed.py
@@ -26,6 +26,7 @@ def setUp(self):
         self.collection.register(SubNeeded())
         self.success_templates = [
             'fixtures/templates/good/functions_sub.yaml',
+            'fixtures/templates/good/functions/sub_needed.yaml',
         ]
 
     def test_file_positive(self):
Repository: aws-cloudformation/cfn-lint

Issue:
E2532 State Machine Definition key (OutputPath) for State of Type (Task) is not valid
cfn-lint version: 0.7.3

I am getting the above error when trying to lint a CF template containing a step function. The step function code is working fine in AWS console though. 

"CreatePublishedRequest": {
                  "Type": "Task",
                  "Resource": "{$createPublishedRequest}",
                  "ResultPath":"$.publishedRequest",
                  "OutputPath":"$.publishedRequest",
                  "Next": "PutRequest"
                },
"PutRequest": {
                  "Type": "Task",
                  "Resource": "{$updateKey}",
                  "ResultPath":"$.response",
                  "Next": "Take Down Mock"
                },

When trying to change to using InputPath in "PutRequest" instead I am getting the same error, but for InputPath instead. 



Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/stepfunctions/StateMachine.py b/src/cfnlint/rules/resources/stepfunctions/StateMachine.py
--- a/src/cfnlint/rules/resources/stepfunctions/StateMachine.py
+++ b/src/cfnlint/rules/resources/stepfunctions/StateMachine.py
@@ -37,13 +37,14 @@ def _check_state_json(self, def_json, state_name, path):
         """Check State JSON Definition"""
         matches = []
 
+        # https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-common-fields.html
         common_state_keys = [
             'Next',
             'End',
             'Type',
             'Comment',
-            'Input',
-            'Ouptut',
+            'InputPath',
+            'OutputPath',
         ]
         common_state_required_keys = [
             'Type',


Test patch:
diff --git a/test/fixtures/templates/good/resources/stepfunctions/state_machine.yaml b/test/fixtures/templates/good/resources/stepfunctions/state_machine.yaml
--- a/test/fixtures/templates/good/resources/stepfunctions/state_machine.yaml
+++ b/test/fixtures/templates/good/resources/stepfunctions/state_machine.yaml
@@ -12,6 +12,19 @@ Resources:
             "HelloWorld": {
               "Type": "Task",
               "Resource": "arn:aws:lambda:us-east-1:111122223333:function:HelloFunction",
+              "Next": "CreatePublishedRequest"
+            },
+            "CreatePublishedRequest": {
+              "Type": "Task",
+              "Resource": "{$createPublishedRequest}",
+              "ResultPath":"$.publishedRequest",
+              "OutputPath":"$.publishedRequest",
+              "Next": "PutRequest"
+              },
+            "PutRequest": {
+              "Type": "Task",
+              "Resource": "{$updateKey}",
+              "ResultPath":"$.response",
               "End": true
             }
           }
Repository: aws-cloudformation/cfn-lint

Issue:
Intermittent test failures for py27
*cfn-lint version: (`cfn-lint --version`)*
0.8.2

*Description of issue.*
TravisCI/tox tests fail intermittently:

```
FAIL: test_file_negative_alias (rules.resources.updatepolicy.test_configuration.TestConfiguration)
Test failure
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cmmeyer/Documents/DevAdvocate/cfn-python-lint/test/rules/resources/updatepolicy/test_configuration.py", line 37, in test_file_negative_alias
    self.helper_file_negative('fixtures/templates/bad/resources/updatepolicy/config.yaml', 10)
  File "/Users/cmmeyer/Documents/DevAdvocate/cfn-python-lint/test/rules/__init__.py", line 52, in helper_file_negative
    self.assertEqual(err_count, len(errs))
AssertionError: 10 != 1
```

Ok on re-run.

Please provide as much information as possible:
* Template linting issues:
  * Please provide a CloudFormation sample that generated the issue.
  * If present, please add links to the (official) documentation for clarification.
* Feature request:
  * Please provide argumentation about the missing feature. Context is key!



Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/updatepolicy/Configuration.py b/src/cfnlint/rules/resources/updatepolicy/Configuration.py
--- a/src/cfnlint/rules/resources/updatepolicy/Configuration.py
+++ b/src/cfnlint/rules/resources/updatepolicy/Configuration.py
@@ -210,6 +210,6 @@ def match(self, cfn):
             else:
                 message = 'UpdatePolicy should be an object'
                 matches.append(
-                    RuleMatch(['Resources', r_name, 'UpdatePolicy'], message.format(path[-1])))
+                    RuleMatch(['Resources', r_name, 'UpdatePolicy'], message.format()))
 
         return matches


Test patch: