[
https://issues.apache.org/jira/browse/FLINK-22786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17352982#comment-17352982
]
Shengkai Fang edited comment on FLINK-22786 at 5/28/21, 6:17 AM:
-----------------------------------------------------------------
Thanks for your report! But I think the main problem is we try to build a
directory that already exists.
I write a test in my local branch to reproduce this problem.
{code:java}
/** Test {@link CliUtils}. */
public class CliUtilsTest {
@Rule public TemporaryFolder realFolder = new TemporaryFolder();
@Rule public TemporaryFolder linkFolder = new TemporaryFolder();
@Test
public void testCreate() throws IOException {
Path link = Paths.get(linkFolder.getRoot().getAbsolutePath(), "link");
Files.createSymbolicLink(link, realFolder.getRoot().toPath());
Path historyFile = Paths.get(link.toAbsolutePath().toString(),
"test.file");
CliUtils.createFile(historyFile);
assertTrue(Files.exists(historyFile));
}
}
{code}
was (Author: fsk119):
Thanks for your report! You are right. Please go ahead.
I write a test in my local branch.
{code:java}
/** Test {@link CliUtils}. */
public class CliUtilsTest {
@Rule public TemporaryFolder realFolder = new TemporaryFolder();
@Rule public TemporaryFolder linkFolder = new TemporaryFolder();
@Test
public void testCreate() throws IOException {
Path link = Paths.get(linkFolder.getRoot().getAbsolutePath(), "link");
Files.createSymbolicLink(link, realFolder.getRoot().toPath());
Path historyFile = Paths.get(link.toAbsolutePath().toString(),
"test.file");
CliUtils.createFile(historyFile);
assertTrue(Files.exists(historyFile));
}
}
{code}
> sql-client can not create .flink-sql-history file
> -------------------------------------------------
>
> Key: FLINK-22786
> URL: https://issues.apache.org/jira/browse/FLINK-22786
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Client
> Affects Versions: 1.12.2
> Reporter: Zhiwen Sun
> Priority: Major
>
> When I run sql-client.sh, I find a warning
> Unable to create history file: /home/www/.flink-sql-history
> In fact, the user I used have permission to write /home/www/.
> After debug sql-client.sh. I think this is a bug in
> org.apache.flink.table.client.cli.CliUtils#createFile
> Files.notExists(parent) should be run before Files.createDirectories(parent) .
--
This message was sent by Atlassian Jira
(v8.3.4#803005)