Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » FileSel&FileList, Path » FindFile.IsSymLink() broken
FindFile.IsSymLink() broken [message #22604] Thu, 30 July 2009 11:03 Go to next message
sam_ is currently offline  sam_
Messages: 4
Registered: July 2009
Location: Pazrava pri Puchove
Junior Member
Hi all. I know it's not very polite to introduce myself with bug report, but...

I would expect following code snippet to return true for "link" (tested on Linux Mint 7.0; based on Ubuntu Jaunty):
#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	String parentDir = GetFileDirectory(GetExeFilePath()), targetDir = AppendFileName(parentDir, "dir");
	//RealizeDirectory(targetDir);
	//Sys(Format("ln -s %s link", targetDir));
	Sys(Format("ln -s %s link_to_dir", GetExeFilePath()));
	FindFile ff(AppendFileName(parentDir, "*"));
	while (ff.Next()) {
		Cout().PutLine(Format("%s: %s", ff.GetName(), ff.IsSymLink() ? "true" : "false"));
	}
	Cout().PutLine(Sys("ls -la " + parentDir));
	DeleteFile(AppendFileName(parentDir, "link"));
	DirectoryDelete(targetDir);
}


According to http://manpages.ubuntu.com/manpages/jaunty/en/man2/stat.2.ht ml problem is in stat() call being used instead of lstat()
If this behaviour was actually intended, I suggest adding default parameter to both FindFile constructors:
FindFile(bool use_lstat = false);
FindFile(const char *name, bool use_lstat = false); 

or perhaps
FindFile(const char *name, bool use_lstat = false);
bool Search(const char *path, bool use_lstat = false);

My preference is to use lstat() only. Thanks for great framework, Lubos
Re: FindFile.IsSymLink() broken [message #22612 is a reply to message #22604] Sat, 01 August 2009 09:12 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Maybe we should use lstat only to detect the link?

Mirek
Re: FindFile.IsSymLink() broken [message #22637 is a reply to message #22612] Mon, 03 August 2009 09:32 Go to previous messageGo to next message
sam_ is currently offline  sam_
Messages: 4
Registered: July 2009
Location: Pazrava pri Puchove
Junior Member
That's fine with me. Thanks, Lubos
Re: FindFile.IsSymLink() broken [message #22725 is a reply to message #22637] Sun, 09 August 2009 00:13 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sam_ wrote on Mon, 03 August 2009 03:32

That's fine with me. Thanks, Lubos


Implemented and commited. Thanks for reporting.

Mirek
Previous Topic: FileSel::Set does not appear to work
Next Topic: A little improvement to AppendFileName
Goto Forum:
  


Current Time: Thu Apr 18 21:14:26 CEST 2024

Total time taken to generate the page: 0.02071 seconds