Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NGINX lens reports "types" as a syntax error incorrectly #834

Open
johnnybubonic opened this issue Jun 20, 2024 · 0 comments
Open

The NGINX lens reports "types" as a syntax error incorrectly #834

johnnybubonic opened this issue Jun 20, 2024 · 0 comments

Comments

@johnnybubonic
Copy link

Place the following as /etc/nginx/conf.d/test.conf:

server {
	listen 127.0.0.1:80;
	server_name poc.localhost;

	types {
	        text/plain h;
	}

	location / {
		root /srv/http;
	}
}

Ensure it is parsed by Nginx:

# grep -E '^\s*include\s+' /etc/nginx/nginx.conf
    include       mime.types;
    include /etc/nginx/conf.d/*.conf;

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# echo $?
0

As you can see, the types directive as a block is perfectly valid and a block is expected per the example in Nginx documentation.

Now try to load it.

augtool> load
augtool> print /augeas/files/etc/nginx/conf.d/test.conf/error
/augeas/files/etc/nginx/conf.d/test.conf/error = "parse_failed"
/augeas/files/etc/nginx/conf.d/test.conf/error/pos = "131"
/augeas/files/etc/nginx/conf.d/test.conf/error/line = "12"
/augeas/files/etc/nginx/conf.d/test.conf/error/char = "0"
/augeas/files/etc/nginx/conf.d/test.conf/error/lens = "/usr/share/augeas/lenses/dist/nginx.aug:121.10-.52:"
/augeas/files/etc/nginx/conf.d/test.conf/error/message = "Syntax error"

The obvious reason is that type is not noted as a block directive (neither in block_re nor block_re_all). However, unlike other block_re_all, it only has the form of <directive> <block>, there are no args.

I tried fiddling with the lens a bit but wasn't able to get it to properly pull in the block itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant