[ 
https://issues.apache.org/jira/browse/LUCENE-10457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17502663#comment-17502663
 ] 

Mike Drob commented on LUCENE-10457:
------------------------------------

> we should suffer the complexity of fixing all tests to deal with symbolic 
> links when lucene doesn't itself create any symbolic links
did this mean _we should not suffer_ because I'm having trouble understanding 
otherwise.

I went through and the problems were ConnectionCostWriter in Ko/Ja analyzers, 
and IndexSplitter. The tests were actually all fine, but creating symbolic 
links in the tests helped uncover these issues. The problems in all three cases 
were paths derived from user input and could easily manifest when somebody used 
a symbolic link directory. We could fix these classes to work with output 
directories (which I have done in my branch already) or we could document that 
under no circumstances can users provide a symlink as a parameter, but that 
feels a little silly.

I don't particularly care about whether we generate symbolic links from 
createTempDir or whether we inject that somewhere else. Lucene already has a 
lot of extension points for tests that do "extra things" like the various file 
system implementations, various buffers that come pre-loaded with offsets, I 
think there's code that arbitrarily corrupts some buffers for testing, etc. 
This doesn't feel too different from any of those. Using createTempDir felt 
good to me because he implementation should theoretically be black box - as a 
caller all that you know or have any right to know is that you've been given a 
directory. Sometimes it might just happen to be a symlink, or maybe it has 
whitespace, or maybe it is on a different filesystem root if that's available 
on the system. None of that matters, you got a directory and you should be able 
to deal with it.

> LuceneTestCase.createTempDir could randomly return symbolic links
> -----------------------------------------------------------------
>
>                 Key: LUCENE-10457
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10457
>             Project: Lucene - Core
>          Issue Type: Task
>          Components: general/test
>            Reporter: Mike Drob
>            Priority: Major
>
> When we are creating temporary directories to use for other Lucene functions, 
> we could occasionally provide symbolic links instead of direct references to 
> directories. If the system running tests doesn't support symbolic links, then 
> we should ignore this option.
> Providing links would be useful to test scenarios for example where users 
> have a symbolic link for the "current" index directory and then rotate that 
> over time but applications still use the same link.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to