Skip to content

srcml process hangs in infinite loop causing system to get stuck #50

@onhate

Description

@onhate

Hi,
We have found an interesting issue with srcml, because I could not find srcml git project I think you guys can help me.

When running Generators.getInstance().getTree(file) the process hangs and never finishs, I traced down to srcml call and discovered that the srcml command was in infinite loop, the .cs file was big and tooke me some time to discover which part of the file was causing the issue but here are the snippets to reproduce it, the first one hangs and the second works, the only differece is replacing new PublishingServices.PublishedPackageToken[template.Tokens.Count] by new PublishingServices.PublishedPackageToken[1]

srcml -l C# --position code1.cs

namespace AnyNamespace
{
	public class AnyClass
	{
        public static PublishResult PublishPackage()
		{
			PublishResult result = new PublishResult();
			PublishingServices.SinglePublishedPackageRequest initRequest = new PublishingServices.SinglePublishedPackageRequest();
			initRequest.Tokens = new PublishingServices.PublishedPackageToken[template.Tokens.Count];
			return result;
		}
    }
}

srcml -l C# --position code2.cs

namespace AnyNamespace
{
	public class AnyClass
	{
        public static PublishResult PublishPackage()
		{
			PublishResult result = new PublishResult();
			PublishingServices.SinglePublishedPackageRequest initRequest = new PublishingServices.SinglePublishedPackageRequest();
			initRequest.Tokens = new PublishingServices.PublishedPackageToken[1];
			return result;
		}
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions