Re: [Firebird-devel] DatabaseAccess path prepended to remote connection strings

2012-07-23 Thread Alex Peshkoff
 On 07/23/12 20:27, Michal Kubecek wrote:
> Hello,
>
> I found a problem in current HEAD. When paths from ISC_PATH are
> prepended to database name in setPath(), this is not done for names
> containing a colon so that we do not try to understand strings like
> '1.2.3.4:aaa' as file names in local directory. But this is not
> checked in resolveDatabaseAccess() so that with
>
>   DatabaseAccess = Restrict /srv/firebird
>
> an attempt to connect to '172.16.114.128:tips' leads to opening local
> file /srv/firebird/172.16.114.128:tips
>
> Proposed patch is attached.

Patch seems to be absolutely correct.
Just interested - did it really try to open something like
'/srv/firebird/172.16.114.128:tips'?


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-3896) crash during expression-based index rebuild

2012-07-23 Thread Philip Williams (JIRA)
crash during expression-based index rebuild
---

 Key: CORE-3896
 URL: http://tracker.firebirdsql.org/browse/CORE-3896
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
 Environment: Observed on FB 2.1.5.18479 (snapshot build) SS x32, on 
W2k8 Server x64
Reporter: Philip Williams


Engine crashes during 'set index active' on expression-based index, possibly 
related to concurrent access.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] DatabaseAccess path prepended to remote connection strings

2012-07-23 Thread Michal Kubecek
Hello,

I found a problem in current HEAD. When paths from ISC_PATH are
prepended to database name in setPath(), this is not done for names
containing a colon so that we do not try to understand strings like
'1.2.3.4:aaa' as file names in local directory. But this is not
checked in resolveDatabaseAccess() so that with

  DatabaseAccess = Restrict /srv/firebird

an attempt to connect to '172.16.114.128:tips' leads to opening local
file /srv/firebird/172.16.114.128:tips

Proposed patch is attached.

   Michal Kubeček

From: Michal Kubecek 
Date: Mon, 23 Jul 2012 16:36:27 +0200
Subject: Do not add DatabaseAccess paths to connection strings

In setPath(), we check that supplied name doesn't contain a colon
or a directory separator so that paths from ISC_PATH are not
prepended to connection strings for remote connections. The same
check is needed in expandDatabaseAccess(), otherwise strings
like '1.2.3.4:abcd' won't work if DatabaseAcess is set to
'Restrict ...'.
---
 src/common/db_alias.cpp |   51 +++
 1 file changed, 21 insertions(+), 30 deletions(-)

diff --git a/src/common/db_alias.cpp b/src/common/db_alias.cpp
index a1f357d..d16b421 100644
--- a/src/common/db_alias.cpp
+++ b/src/common/db_alias.cpp
@@ -261,6 +261,16 @@ namespace
 	InitInstance aliasesConf;
 }
 
+// Checks that argument doesn't contain colon or directory separator
+static inline bool hasSeparator(const PathName& name)
+{
+	for (const char* p = name.c_str(); *p; p++) {
+		if (*p == ':' || *p == '/' || *p == '\\')
+			return true;
+	}
+	return false;
+}
+
 // Search for 'alias' in aliases.conf, return its value in 'file' if found. Else set file to alias.
 // Returns true if alias is found in aliases.conf.
 static bool resolveAlias(const PathName& alias, PathName& file, RefPtr* config)
@@ -289,38 +299,22 @@ static bool resolveAlias(const PathName& alias, PathName& file, RefPtr*
 // Returns true if expanded successfully.
 static bool resolveDatabaseAccess(const PathName& alias, PathName& file)
 {
-	PathName correctedAlias = alias;
-	replace_dir_sep(correctedAlias);
-
-	bool rc = true;
+	file = alias;
 
-	PathName path, name;
-	PathUtils::splitLastComponent(path, name, correctedAlias);
+	if (hasSeparator(alias))
+		return false;
 
-	// if path component not present in file_name
-	if (path.isEmpty())
+	// try to expand to existing file
+	if (!databaseDirectoryList().expandFileName(file, alias))
 	{
-		// try to expand to existing file
-		if (!databaseDirectoryList().expandFileName(file, name))
+		// try to use default path
+		if (!databaseDirectoryList().defaultName(file, alias))
 		{
-			// try to use default path
-			if (!databaseDirectoryList().defaultName(file, name))
-			{
-rc = false;
-			}
+			return false;
 		}
 	}
-	else
-	{
-		rc = false;
-	}
-
-	if (! rc)
-	{
-		file = correctedAlias;
-	}
 
-	return rc;
+	return true;
 }
 
 // Set a prefix to a filename based on the ISC_PATH user variable.
@@ -333,11 +327,8 @@ static bool setPath(const PathName& filename, PathName& expandedName)
 		return false;
 
 	// If the file already contains a remote node or any path at all forget it.
-	for (const char* p = filename.c_str(); *p; p++)
-	{
-		if (*p == ':' || *p == '/' || *p == '\\')
-			return false;
-	}
+	if (hasSeparator(filename))
+		return false;
 
 	// concatenate the strings
 
-- 
1.7.10.4

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Building Firebird for Android

2012-07-23 Thread Adriano dos Santos Fernandes
On 23/07/2012 10:34, Alex Peshkoff wrote:
>  On 07/23/12 14:41, Adriano dos Santos Fernandes wrote:
>> On 23/07/2012 06:49, Alex Peshkoff wrote:
>>> Somewhy it happened that in my trunk I have platform.h in
>>> extern/icu/source/common/unicode. No idea how did it arrive in that dir
>>> (certainly, not under version control). As far as I know about Android,
>>> icu libraries are present in default device's setup. But question comes
>>> - what is best way to access them when doing cross-build?
>> If it's not in the NDK, then the library is unsupported and may not be
>> in all versions. It's there just to the OS.
>>
>> So in this case we should supply it. But for client only we would not
>> need ICU. This is a problem of our "common" library who have server-code
>> which is never called by the client.
> Hmm...
> I do remember that I had to add CharSet.cpp to common in order to build
> client. Will recheck.
>
>
The problem is that some things (specially unicode_util) was added to
common, but in fact, it's a piece needed only in engine and intl libraries.


Adriano


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Building Firebird for Android

2012-07-23 Thread Alex Peshkoff
 On 07/23/12 14:41, Adriano dos Santos Fernandes wrote:
> On 23/07/2012 06:49, Alex Peshkoff wrote:
>> Somewhy it happened that in my trunk I have platform.h in
>> extern/icu/source/common/unicode. No idea how did it arrive in that dir
>> (certainly, not under version control). As far as I know about Android,
>> icu libraries are present in default device's setup. But question comes
>> - what is best way to access them when doing cross-build?
> If it's not in the NDK, then the library is unsupported and may not be
> in all versions. It's there just to the OS.
>
> So in this case we should supply it. But for client only we would not
> need ICU. This is a problem of our "common" library who have server-code
> which is never called by the client.

Hmm...
I do remember that I had to add CharSet.cpp to common in order to build
client. Will recheck.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Building Firebird for Android

2012-07-23 Thread Adriano dos Santos Fernandes
On 23/07/2012 06:49, Alex Peshkoff wrote:
> Somewhy it happened that in my trunk I have platform.h in
> extern/icu/source/common/unicode. No idea how did it arrive in that dir
> (certainly, not under version control). As far as I know about Android,
> icu libraries are present in default device's setup. But question comes
> - what is best way to access them when doing cross-build?

If it's not in the NDK, then the library is unsupported and may not be
in all versions. It's there just to the OS.

So in this case we should supply it. But for client only we would not
need ICU. This is a problem of our "common" library who have server-code
which is never called by the client.


Adriano


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Building Firebird for Android

2012-07-23 Thread Alex Peshkoff
 On 07/23/12 06:03, Adriano dos Santos Fernandes wrote:
>> Checkout trunk and use the following configure (autogen.sh) parameter
>> --with-cross-build=android.arme
>>
> I tried it, with official NDK but got error compiling common/CharSet.cpp
> which needs ICU. So not even the client compiled.
>
> ---
> asfernandes:~/fb/dev/trunk.git$ echo $NDK
> /home/asfernandes/android/android-ndk-r8
>
> asfernandes:~/fb/dev/trunk.git$ ./autogen.sh --with-cross-build=android.arme
>
> /home/asfernandes/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++
> -ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DANDROID -DARM -pipe -MMD
> -fPIC -fmessage-length=0
> -I/home/asfernandes/fb/dev/trunk.git/extern/libtommath
> --sysroot=/home/asfernandes/android/android-ndk-r8/platforms/android-9/arch-arm
> -I/home/asfernandes/fb/dev/trunk.git/extern/icu/source/common
> -I/home/asfernandes/fb/dev/trunk.git/extern/icu/source/i18n -O3
> -fno-omit-frame-pointer
> -I/home/asfernandes/fb/dev/trunk.git/src/include/gen
> -I/home/asfernandes/fb/dev/trunk.git/src/include  -pthread -fno-rtti
> -c /home/asfernandes/fb/dev/trunk.git/src/common/CharSet.cpp -o
> /home/asfernandes/fb/dev/trunk.git/temp/Release/common/CharSet.o
> In file included from
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/utypes.h:36,
>  from
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/ucnv.h:56,
>  from
> /home/asfernandes/fb/dev/trunk.git/src/common/../jrd/../common/unicode_util.h:33,
>  from
> /home/asfernandes/fb/dev/trunk.git/src/common/../jrd/intl_classes.h:35,
>  from
> /home/asfernandes/fb/dev/trunk.git/src/common/CharSet.cpp:95:
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/umachine.h:52:33:
> error: unicode/platform.h: No such file or directory
> ---
>

Somewhy it happened that in my trunk I have platform.h in
extern/icu/source/common/unicode. No idea how did it arrive in that dir
(certainly, not under version control). As far as I know about Android,
icu libraries are present in default device's setup. But question comes
- what is best way to access them when doing cross-build?

>> BTW - I did not find any VM in android's NDK. What is the best way to
>> check/debug android's soft?
> The VM comes with the *SDK*. 

Ahh - thank you.

> AFAIU, Android Apps can't be standalone
> native executable. It must have a Java (Dalvik) laucher which calls the
> native part as JNI.

Using latest NDK one can build complete native application. But for
firebird this does not appear critical - first of all we provide
libraries, out utlities do not make much sense (except for people who
have non-standard Android with command line support). I hope that to
start daemon on linux we need not have Java wrapper for it? :-)

> Please note file docs/STANDALONE-TOOLCHAIN.html. It says that without
> installing the toolchain in different location, RTTI, STL and exceptions
> can't be used.

That's not completely true. Setting correct flags for linker one can use
at least exceptions without any problems. They should not cross module
boundaries - but that's OK for us.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] [FB-Tracker] Created: (CORE-3895) High memory usage when PSQL code SELECT's from stored procedure which modified some data

2012-07-23 Thread Vlad Khorsun (JIRA)
High memory usage when PSQL code SELECT's from stored procedure which modified 
some data


 Key: CORE-3895
 URL: http://tracker.firebirdsql.org/browse/CORE-3895
 Project: Firebird Core
  Issue Type: Bug
  Components: Engine
Affects Versions: 2.5.1
Reporter: Vlad Khorsun


Test case:

1. create metadata
create table t (id  integer not null);

set term ^;

create or alter procedure selproc (p_id integer) returns (id integer)
AS
begin
  insert into t values (:p_id);
  id = p_id;
  suspend;
end
^

create or alter procedure main returns (id integer)
as
declare I integer = 0;
begin
  while (i < 1000) do begin
select id from selproc(:i) into :id;
i = i + 1;
  end
  suspend;
end
^

set term ;^

2. run test and look at memory usage (below i removed not needed stats)
set stat on;

SQL> select * from main;

  ID

 999

Current memory = 4852448
Delta memory = 257764
Max memory = 4859608

SQL> select * from main;

  ID

 999

Current memory = 4961764
Delta memory = 109316
Max memory = 4974260

SQL> select * from main;

  ID

 999

Current memory = 5071132
Delta memory = 109368
Max memory = 5081956

you see - memory usage is incremented at each run by 109368 bytes

SQL> commit;
Current memory = 4735108
Delta memory = -336024
Max memory = 5081956

memory is returned on commit. But it shoud be returned at the statement 
execution finish.

If replace "select from selproc" by "execute procedure selproc" then there is 
no such high memory usage.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Building Firebird for Android

2012-07-23 Thread marius adrian popa
On Mon, Jul 23, 2012 at 11:21 AM, JLM  wrote:

> On 23/07/2012 04:03, Adriano dos Santos Fernandes wrote:
>
> > I tried it, with official NDK but got error compiling common/CharSet.cpp
> > which needs ICU. So not even the client compiled.
> >
> > ---
> > asfernandes:~/fb/dev/trunk.git$ echo $NDK
> > /home/asfernandes/android/android-ndk-r8
> >
> > asfernandes:~/fb/dev/trunk.git$ ./autogen.sh
> --with-cross-build=android.arme
> >
> >
> /home/asfernandes/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++
> > -ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DANDROID -DARM -pipe -MMD
> > -fPIC -fmessage-length=0
> > -I/home/asfernandes/fb/dev/trunk.git/extern/libtommath
> >
> --sysroot=/home/asfernandes/android/android-ndk-r8/platforms/android-9/arch-arm
> > -I/home/asfernandes/fb/dev/trunk.git/extern/icu/source/common
> > -I/home/asfernandes/fb/dev/trunk.git/extern/icu/source/i18n -O3
> > -fno-omit-frame-pointer
> > -I/home/asfernandes/fb/dev/trunk.git/src/include/gen
> > -I/home/asfernandes/fb/dev/trunk.git/src/include  -pthread -fno-rtti
> > -c /home/asfernandes/fb/dev/trunk.git/src/common/CharSet.cpp -o
> > /home/asfernandes/fb/dev/trunk.git/temp/Release/common/CharSet.o
> > In file included from
> >
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/utypes.h:36,
> >   from
> >
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/ucnv.h:56,
> >   from
> >
> /home/asfernandes/fb/dev/trunk.git/src/common/../jrd/../common/unicode_util.h:33,
> >   from
> > /home/asfernandes/fb/dev/trunk.git/src/common/../jrd/intl_classes.h:35,
> >   from
> > /home/asfernandes/fb/dev/trunk.git/src/common/CharSet.cpp:95:
> >
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/umachine.h:52:33:
> > error: unicode/platform.h: No such file or directory
> > ---
>
> Since I tried to compile Firebird2.1, I add inch by inch libraries wich
> were missing in the NDK to compile. I take them from a debian ARM
> virtual machine. And I carry out the libfbclient.so successfully.
>
> Now, I will test this library. With Java, it's seems impossible because
> it can't communicate with Firebird for the moment. So I will try to use
> Qt Necessitas. Do you think Necessitas can runs with Firebird ?
>

qt does have support for firebird , so if you compile the ibase driver it
should in theory
load the  ibfbclient.so that you compiled and then comunicate with another
server from internet (for example)
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Building Firebird for Android

2012-07-23 Thread JLM
On 23/07/2012 04:03, Adriano dos Santos Fernandes wrote:

> I tried it, with official NDK but got error compiling common/CharSet.cpp
> which needs ICU. So not even the client compiled.
>
> ---
> asfernandes:~/fb/dev/trunk.git$ echo $NDK
> /home/asfernandes/android/android-ndk-r8
>
> asfernandes:~/fb/dev/trunk.git$ ./autogen.sh --with-cross-build=android.arme
>
> /home/asfernandes/android/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++
> -ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DANDROID -DARM -pipe -MMD
> -fPIC -fmessage-length=0
> -I/home/asfernandes/fb/dev/trunk.git/extern/libtommath
> --sysroot=/home/asfernandes/android/android-ndk-r8/platforms/android-9/arch-arm
> -I/home/asfernandes/fb/dev/trunk.git/extern/icu/source/common
> -I/home/asfernandes/fb/dev/trunk.git/extern/icu/source/i18n -O3
> -fno-omit-frame-pointer
> -I/home/asfernandes/fb/dev/trunk.git/src/include/gen
> -I/home/asfernandes/fb/dev/trunk.git/src/include  -pthread -fno-rtti
> -c /home/asfernandes/fb/dev/trunk.git/src/common/CharSet.cpp -o
> /home/asfernandes/fb/dev/trunk.git/temp/Release/common/CharSet.o
> In file included from
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/utypes.h:36,
>   from
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/ucnv.h:56,
>   from
> /home/asfernandes/fb/dev/trunk.git/src/common/../jrd/../common/unicode_util.h:33,
>   from
> /home/asfernandes/fb/dev/trunk.git/src/common/../jrd/intl_classes.h:35,
>   from
> /home/asfernandes/fb/dev/trunk.git/src/common/CharSet.cpp:95:
> /home/asfernandes/fb/dev/trunk.git/extern/icu/source/common/unicode/umachine.h:52:33:
> error: unicode/platform.h: No such file or directory
> ---

Since I tried to compile Firebird2.1, I add inch by inch libraries wich 
were missing in the NDK to compile. I take them from a debian ARM 
virtual machine. And I carry out the libfbclient.so successfully.

Now, I will test this library. With Java, it's seems impossible because 
it can't communicate with Firebird for the moment. So I will try to use 
Qt Necessitas. Do you think Necessitas can runs with Firebird ?

Jean-Louis Meuriot


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel