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

[BUG] OpenSearch Core 1.3.0 including ja in JDK man pages #2517

Closed
peterzhuamazon opened this issue Mar 18, 2022 · 16 comments · Fixed by #2602
Closed

[BUG] OpenSearch Core 1.3.0 including ja in JDK man pages #2517

peterzhuamazon opened this issue Mar 18, 2022 · 16 comments · Fixed by #2602
Labels
bug Something isn't working

Comments

@peterzhuamazon
Copy link
Member

peterzhuamazon commented Mar 18, 2022

In rpm assemble through build repo code, we will extract the files from core rpm.

It failed with this error once we switch from 14 to 11 on JDK for 1.3.0.

cpio: cannot make directory `./usr/share/opensearch/jdk/man/ja': No such file or directory
cpio: ./usr/share/opensearch/jdk/man/ja/man1: Cannot mkdir: No such file or directory

Root cause:

jdk14:
opensearch-1.2.4/jdk/man
drwxr-x--- 2 <> 4096 Jan 14 03:42 man1
jdk11:
opensearch-1.3.0/jdk/man
lrwxrwxrwx 1 <>   11 Mar 15 19:28 ja -> ja_JP.UTF-8
drwxr-x--- 3 <> 4096 Jan  1  1970 ja_JP.UTF-8
drwxr-x--- 2 <> 4096 Jan  1  1970 man1

There is a new folder ja_JP.UTF-8 and a new symlink ja which caused cpio to fail as it tries to treat symlink as a folder here.

General question on why this folder is needed as a result.
And whether we need to make changes on cpio to omit this error.

Thanks.

@peterzhuamazon
Copy link
Member Author

Update: This is only for jdk11 in 1.3.0. As for jdk17 in 2.0.0 this is not an issue at all


total 4
drwxr-xr-x 2 zhujiaxi amazon 4096 Mar 21 19:41 man1

@bbarani
Copy link
Member

bbarani commented Mar 21, 2022

@CEHENKLE @saratvemulapalli This is blocking RPM builds. Can you please prioritize it?

@dblock
Copy link
Member

dblock commented Mar 21, 2022

How does one reproduce this? Where's the cpio code?

@saratvemulapalli
Copy link
Member

@peterzhuamazon could you help understand what process is cpio doing?

From what I see JDK versions < 12 have Japan version of man pages bundled.
The ja directory is a symlink which points to the JP manpages.
This is nothing specific to OpenSearch and comes from JDK out of the box.

As far as I understand its a no-op and you should be able to skip the ja directory.
But my recommendation would be to package as JDK distributions do (i.e include ja symlink).
This will make us follow the convention rather than tearing it apart.

Ref:
[1] https://mail.openjdk.java.net/pipermail/build-dev/2020-June/027643.html

@peterzhuamazon
Copy link
Member Author

peterzhuamazon commented Mar 21, 2022

Easiest way to reproduce this one:

# Build rpm
./build.sh manifests/1.3.0/opensearch-1.3.0.yml --platform linux --distribution rpm --component OpenSearch

# Try extraction
cd builds/opensearch/dist
rpm2cpio <rpm file> | cpio -imdv

You will see:

cpio: cannot make directory `./usr/share/opensearch/jdk/man/ja': No such file or directory
cpio: ./usr/share/opensearch/jdk/man/ja/man1: Cannot mkdir: No such file or directory

Then check usr/share/opensearch/jdk/man and you see jp.

This does not happen on jdk14 or jdk17, only on jdk11.

Thanks.

@peterzhuamazon
Copy link
Member Author

Since cpio does not process symlink well, it will cause the cpio to return error code 2 and stop the assemble process.
If we want to release 1.3.x version of rpm then this is a blocker.
Not a blocker for 2.0.0+ for now.

@saratvemulapalli
Copy link
Member

Since cpio does not process symlink well, it will cause the cpio to return error code 2 and stop the assemble process. If we want to release 1.3.x version of rpm then this is a blocker. Not a blocker for 2.0.0+ for now.

I understand that. As i've linked, JDK versions < 12 will have this problem. ( I've verified 8,11 not sure about others)
Anyway, whats the question here for OpenSearch?
If its the tooling problem lets figure that out.

@dblock
Copy link
Member

dblock commented Mar 21, 2022

https://superuser.com/questions/1005740/how-do-i-deal-with-unpacking-of-archive-failed-cpio-symlink seems to offer some options - I am not familiar with cpio to say what we should be doing about this

@peterzhuamazon
Copy link
Member Author

After talking to @saratvemulapalli and sees this is only an additional symlink due to JDK pre 12 incorrectly include it.
If we are releasing 1.3.x rpm this would be blocking, we probably need to add some additional script / code so ja can be removed before the 1st bundling.
If we are releasing 2.0.x rpm this would not be an issue.

Thanks.

@saratvemulapalli
Copy link
Member

Closing this.
Feel free to re-open @peterzhuamazon if you have more questions!

@peterzhuamazon
Copy link
Member Author

@saratvemulapalli We will support 1.3.0 version of OpenSearch will need to address this with a patch in core by creating a separate branch based on tags/1.3.0 and remove ja related symlink/folder before core rpm is built.

@dblock
Copy link
Member

dblock commented Mar 22, 2022

@saratvemulapalli We will support 1.3.0 version of OpenSearch will need to address this with a patch in core by creating a separate branch based on tags/1.3.0 and remove ja related symlink/folder before core rpm is built.

This needs to be a 1.3.1 because it's no longer a 1.3.0.

@peterzhuamazon
Copy link
Member Author

  1. Long Term: Support TYPE during core build, TYPE=archives/packages/dirs.
    User can do distribution=rpm;type=dirs and they will be provided with directory of files that is built for rpm
  2. Short Term: Creating a new branch of 1.3-rpm and allow core to delete ja related links/folder during build.

@saratvemulapalli
Copy link
Member

saratvemulapalli commented Mar 22, 2022

  1. I love the long term approach, keeps it simple for all our bundling. Could you open an issue for this?
    I would invest time on this as it helps our bundling with tarball, RPM and DEB for all versions down the line.
  2. I dont like the short term approach because the rootcause is the tool, it doesn’t understand symlinks. The symlink was generated with JDK distribution (nothing to do with OpenSearch).
    I would rather have the rootcause fixed, than putting in a hack in OpenSearch (and be worried about maintaining it forever).

andrross added a commit to andrross/OpenSearch that referenced this issue Mar 25, 2022
This is a short-term solution to unblock the build process for the 1.3
release. A tool used in that process (cpio) is failing on a symlink in
the JDK man pages, so this is a hack to just remove that symlink. See
issue opensearch-project#2517 for more details.

Signed-off-by: Andrew Ross <[email protected]>
@peterzhuamazon peterzhuamazon linked a pull request Mar 25, 2022 that will close this issue
5 tasks
@peterzhuamazon
Copy link
Member Author

@dblock @saratvemulapalli This PR #2602 is raised to resolve this issue temporarily.
@xuezhou25 is working on resolving #2571 on a separate PR.

Thanks.

@peterzhuamazon
Copy link
Member Author

Testing proves that dashboards does not have similar issues:


./usr/share/opensearch-dashboards/src/setup_node_env/root/is_root.js
./var/lib/opensearch-dashboards
582913 blocks

% echo $?
0

peterzhuamazon pushed a commit that referenced this issue Mar 25, 2022
This is a short-term solution to unblock the build process for the 1.3
release. A tool used in that process (cpio) is failing on a symlink in
the JDK man pages, so this is a hack to just remove that symlink. See
issue #2517 for more details.

Signed-off-by: Andrew Ross <[email protected]>
peterzhuamazon pushed a commit to peterzhuamazon/OpenSearch that referenced this issue Mar 26, 2022
This is a short-term solution to unblock the build process for the 1.3
release. A tool used in that process (cpio) is failing on a symlink in
the JDK man pages, so this is a hack to just remove that symlink. See
issue opensearch-project#2517 for more details.

Signed-off-by: Andrew Ross <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants