File 0477-Update-remaining-usages-of-app-less-include_lib.patch of Package erlang

From 191f581c817cb735cd511d601f85d1d677a6096d Mon Sep 17 00:00:00 2001
From: Daniel Gorin <danielgo@meta.com>
Date: Sun, 14 Sep 2025 15:45:31 +0100
Subject: [PATCH] Update remaining usages of app-less -include_lib()

`erl_tar.hrl` is a private header file of stdlib, but `erl_tar.erl` is including it with:

```
-include_lib("erl_tar.hrl").
```

While this works, it breaks some code-analysis tools that (too strictly?) expect an `-include_lib()` argument to be of the form `"APP/include/HEADER.hrl"`.

There doesn't seem to be any advantage to it this way, so let's use `-include("erl_tar.hrl").` instead.

In fact, this was almost the only case in otp where something was included this way. There were a couple of similar usages of `-include_lib()` in some dialyzer tests and in documentation, so we update those places here as well.
---
 FILE-HEADERS/MPL-1.1.txt                      |  9 +++++++
 .../doc/guides/dependencies_chapter.md        |  4 +--
 .../opaque_SUITE_data/src/ewgi/ewgi_api.erl   | 26 +++++++++----------
 .../src/ewgi/ewgi_testapp.erl                 | 24 ++++++++---------
 .../opaque_SUITE_data/src/ewgi2/ewgi_api.erl  | 26 +++++++++----------
 .../src/ewgi2/ewgi_testapp.erl                | 24 ++++++++---------
 lib/inets/doc/guides/http_server.md           |  2 +-
 lib/stdlib/src/erl_tar.erl                    |  2 +-
 8 files changed, 63 insertions(+), 54 deletions(-)
 create mode 100644 FILE-HEADERS/MPL-1.1.txt

diff --git a/FILE-HEADERS/MPL-1.1.txt b/FILE-HEADERS/MPL-1.1.txt
new file mode 100644
index 0000000000..6dd1d49ce4
--- /dev/null
+++ b/FILE-HEADERS/MPL-1.1.txt
@@ -0,0 +1,9 @@
+The contents of this file are subject to the Mozilla Public
+License Version 1.1 (the "License"); you may not use this file
+except in compliance with the License. You may obtain a copy of
+the License at http://www.mozilla.org/MPL/
+
+Software distributed under the License is distributed on an "AS IS"
+basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+the License for the specific language governing rights and
+limitations under the License.
diff --git a/lib/common_test/doc/guides/dependencies_chapter.md b/lib/common_test/doc/guides/dependencies_chapter.md
index 7c03e264cd..235b00fb39 100644
--- a/lib/common_test/doc/guides/dependencies_chapter.md
+++ b/lib/common_test/doc/guides/dependencies_chapter.md
@@ -80,7 +80,7 @@ into one test case. The resulting suite can look as follows:
 ```erlang
 -module(my_server_SUITE).
 -compile(export_all).
--include_lib("ct.hrl").
+-include_lib("common_test/include/ct.hrl").
 
 %%% init and end functions...
 
@@ -184,7 +184,7 @@ _Example:_
 ```erlang
 -module(server_b_SUITE).
 -compile(export_all).
--include_lib("ct.hrl").
+-include_lib("common_test/include/ct.hrl").
 
 %%% init and end functions...
 
diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_api.erl b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_api.erl
index 60da757d3b..7ead8ea9e7 100644
--- a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_api.erl
+++ b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_api.erl
@@ -1,8 +1,9 @@
-%%%-------------------------------------------------------------------
-%%% File    : ewgi_api.erl
-%%% Authors : Filippo Pacini <filippo.pacini@gmail.com>
-%%%           Hunter Morris <huntermorris@gmail.com>
-%%% License :
+%%% %CopyrightBegin%
+%%%
+%%% SPDX-License-Identifier: MPL-1.1
+%%%
+%%% Copyright 2007 S.G. Consulting srl
+%%%
 %%% The contents of this file are subject to the Mozilla Public
 %%% License Version 1.1 (the "License"); you may not use this file
 %%% except in compliance with the License. You may obtain a copy of
@@ -12,20 +13,19 @@
 %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %%% the License for the specific language governing rights and
 %%% limitations under the License.
+%%%
+%%% %CopyrightEnd%
+%%%
+%%% Authors : Filippo Pacini <filippo.pacini@gmail.com>
+%%%           Hunter Morris <huntermorris@gmail.com>
+%%%
 %%% The Initial Developer of the Original Code is S.G. Consulting
 %%% srl. Portions created by S.G. Consulting s.r.l. are Copyright (C)
 %%% 2007 S.G. Consulting srl. All Rights Reserved.
 %%%
-%%% @doc
-%%% <p>ewgi API. Defines a low level CGI like API.</p>
-%%%
-%%% @end
-%%%
-%%% Created : 10 Oct 2007 by Filippo Pacini <filippo.pacini@gmail.com>
-%%%-------------------------------------------------------------------
 -module(ewgi_api).
 
--include_lib("ewgi.hrl").
+-include("ewgi.hrl").
 
 -export([get_all_headers/1, get_all_data/1]).
 
diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_testapp.erl b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_testapp.erl
index 59c1ae9206..0dca48de32 100644
--- a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_testapp.erl
+++ b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi/ewgi_testapp.erl
@@ -1,7 +1,9 @@
-%%%-------------------------------------------------------------------
-%%% File    : ewgi_testapp.erl
-%%% Authors : Hunter Morris <huntermorris@gmail.com>
-%%% License :
+%%% %CopyrightBegin%
+%%%
+%%% SPDX-License-Identifier: MPL-1.1
+%%%
+%%% Copyright 2007 S.G. Consulting srl
+%%%
 %%% The contents of this file are subject to the Mozilla Public
 %%% License Version 1.1 (the "License"); you may not use this file
 %%% except in compliance with the License. You may obtain a copy of
@@ -11,22 +13,20 @@
 %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %%% the License for the specific language governing rights and
 %%% limitations under the License.
+%%%
+%%% %CopyrightEnd%
+%%%
+%%% Authors : Hunter Morris <huntermorris@gmail.com>
+%%%
 %%% The Initial Developer of the Original Code is S.G. Consulting
 %%% srl. Portions created by S.G. Consulting s.r.l. are Copyright (C)
 %%% 2007 S.G. Consulting srl. All Rights Reserved.
 %%%
-%%% @doc
-%%% <p>ewgi test applications</p>
-%%%
-%%% @end
-%%%
-%%% Created : 05 July 2009 by Hunter Morris <huntermorris@gmail.com>
-%%%-------------------------------------------------------------------
 -module(ewgi_testapp).
 
 -export([htmlise/1]).
 
--include_lib("ewgi.hrl").
+-include("ewgi.hrl").
 
 htmlise(C) ->
     iolist_to_binary(
diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_api.erl b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_api.erl
index 60da757d3b..7ead8ea9e7 100644
--- a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_api.erl
+++ b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_api.erl
@@ -1,8 +1,9 @@
-%%%-------------------------------------------------------------------
-%%% File    : ewgi_api.erl
-%%% Authors : Filippo Pacini <filippo.pacini@gmail.com>
-%%%           Hunter Morris <huntermorris@gmail.com>
-%%% License :
+%%% %CopyrightBegin%
+%%%
+%%% SPDX-License-Identifier: MPL-1.1
+%%%
+%%% Copyright 2007 S.G. Consulting srl
+%%%
 %%% The contents of this file are subject to the Mozilla Public
 %%% License Version 1.1 (the "License"); you may not use this file
 %%% except in compliance with the License. You may obtain a copy of
@@ -12,20 +13,19 @@
 %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %%% the License for the specific language governing rights and
 %%% limitations under the License.
+%%%
+%%% %CopyrightEnd%
+%%%
+%%% Authors : Filippo Pacini <filippo.pacini@gmail.com>
+%%%           Hunter Morris <huntermorris@gmail.com>
+%%%
 %%% The Initial Developer of the Original Code is S.G. Consulting
 %%% srl. Portions created by S.G. Consulting s.r.l. are Copyright (C)
 %%% 2007 S.G. Consulting srl. All Rights Reserved.
 %%%
-%%% @doc
-%%% <p>ewgi API. Defines a low level CGI like API.</p>
-%%%
-%%% @end
-%%%
-%%% Created : 10 Oct 2007 by Filippo Pacini <filippo.pacini@gmail.com>
-%%%-------------------------------------------------------------------
 -module(ewgi_api).
 
--include_lib("ewgi.hrl").
+-include("ewgi.hrl").
 
 -export([get_all_headers/1, get_all_data/1]).
 
diff --git a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_testapp.erl b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_testapp.erl
index 59c1ae9206..0dca48de32 100644
--- a/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_testapp.erl
+++ b/lib/dialyzer/test/opaque_SUITE_data/src/ewgi2/ewgi_testapp.erl
@@ -1,7 +1,9 @@
-%%%-------------------------------------------------------------------
-%%% File    : ewgi_testapp.erl
-%%% Authors : Hunter Morris <huntermorris@gmail.com>
-%%% License :
+%%% %CopyrightBegin%
+%%%
+%%% SPDX-License-Identifier: MPL-1.1
+%%%
+%%% Copyright 2007 S.G. Consulting srl
+%%%
 %%% The contents of this file are subject to the Mozilla Public
 %%% License Version 1.1 (the "License"); you may not use this file
 %%% except in compliance with the License. You may obtain a copy of
@@ -11,22 +13,20 @@
 %%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %%% the License for the specific language governing rights and
 %%% limitations under the License.
+%%%
+%%% %CopyrightEnd%
+%%%
+%%% Authors : Hunter Morris <huntermorris@gmail.com>
+%%%
 %%% The Initial Developer of the Original Code is S.G. Consulting
 %%% srl. Portions created by S.G. Consulting s.r.l. are Copyright (C)
 %%% 2007 S.G. Consulting srl. All Rights Reserved.
 %%%
-%%% @doc
-%%% <p>ewgi test applications</p>
-%%%
-%%% @end
-%%%
-%%% Created : 05 July 2009 by Hunter Morris <huntermorris@gmail.com>
-%%%-------------------------------------------------------------------
 -module(ewgi_testapp).
 
 -export([htmlise/1]).
 
--include_lib("ewgi.hrl").
+-include("ewgi.hrl").
 
 htmlise(C) ->
     iolist_to_binary(
diff --git a/lib/inets/doc/guides/http_server.md b/lib/inets/doc/guides/http_server.md
index f385837b47..c8abca39c6 100644
--- a/lib/inets/doc/guides/http_server.md
+++ b/lib/inets/doc/guides/http_server.md
@@ -364,7 +364,7 @@ the schema and the tables are already created.
 ```erlang
 -module(mnesia_test).
 -export([start/0,load_data/0]).
--include_lib("mod_auth.hrl").
+-include_lib("inets/include/mod_auth.hrl").
 
 first_start() ->
     mnesia:create_schema([node()]),
diff --git a/lib/stdlib/src/erl_tar.erl b/lib/stdlib/src/erl_tar.erl
index 9d1e5cb5b5..b63ebc8d1c 100644
--- a/lib/stdlib/src/erl_tar.erl
+++ b/lib/stdlib/src/erl_tar.erl
@@ -110,7 +110,7 @@ opens a tar file on a remote machine using an SFTP channel.
          format_error/1]).
 
 -include_lib("kernel/include/file.hrl").
--include_lib("erl_tar.hrl").
+-include("erl_tar.hrl").
 
 %% Converts the short error reason to a descriptive string.
 -doc "Converts an error reason term to a human-readable error message string.".
-- 
2.51.0

openSUSE Build Service is sponsored by