Re: [rebase/patch] Support IMAGE_REL_BASED_DIR64 relocations

2013-01-15 Thread Jason Tishler
Corinna,

On Tue, Jan 15, 2013 at 01:37:10PM +0100, Corinna Vinschen wrote:
> While looking into Marco's rebase problem I noticed that 64 bit support
> in rebase was not complete.  64 bit uses IMAGE_REL_BASED_DIR64 relocation
> entries, which were simply ignored since only the 32 bit variation
> IMAGE_REL_BASED_HIGHLOW was supported at all.  Also, it would have been
> impossible to relocate 64 bit DLLs to addresses beyond the 4GB border
> since the offset difference was kept as an int value.  The below patch
> fixes both oversight.
> 
> Ok to apply?

Yes.  Let me know when you are ready and I will make a release.

Thanks,
Jason


[rebase/patch] Support IMAGE_REL_BASED_DIR64 relocations

2013-01-15 Thread Corinna Vinschen
Hi Jason,

While looking into Marco's rebase problem I noticed that 64 bit support
in rebase was not complete.  64 bit uses IMAGE_REL_BASED_DIR64 relocation
entries, which were simply ignored since only the 32 bit variation
IMAGE_REL_BASED_HIGHLOW was supported at all.  Also, it would have been
impossible to relocate 64 bit DLLs to addresses beyond the 4GB border
since the offset difference was kept as an int value.  The below patch
fixes both oversight.

Ok to apply?


Thanks,
Corinna


* objectfile.h (LinkedObjectFile::performRelocation): Change type of
parameter to int64_t.
* rebaseimage.cc (ReBaseImage64): Change type of local variable
difference to int64_t.
* sections.cc (Relocations::check): Fix formatting.
(Relocations::relocate): Take difference parameter as int64_t.  Call
cursec->debugprint rather than cursec->print and drop FIXME comment.
Handle Windows relocation info types IMAGE_REL_BASED_ABSOLUTE,
IMAGE_REL_BASED_HIGHLOW and IMAGE_REL_BASED_DIR64.  Print error
output if another relocation type is found.  Fix formatting.
* sections.h (Relocations::relocate): Change type of parameter to
int64_t.


Index: imagehelper/objectfile.h
===
RCS file: 
/sourceware/projects/cygwin-apps-home/cvsfiles/rebase/imagehelper/objectfile.h,v
retrieving revision 1.6
diff -u -p -r1.6 objectfile.h
--- imagehelper/objectfile.h19 Mar 2012 17:57:49 -  1.6
+++ imagehelper/objectfile.h15 Jan 2013 12:35:45 -
@@ -125,7 +125,7 @@ class LinkedObjectFile : public ObjectFi
 {
   return relocs->fix();
 }
-bool performRelocation(int difference)
+bool performRelocation(int64_t difference)
 {
   return relocs->relocate(difference);
 }
Index: imagehelper/rebaseimage.cc
===
RCS file: 
/sourceware/projects/cygwin-apps-home/cvsfiles/rebase/imagehelper/rebaseimage.cc,v
retrieving revision 1.6
diff -u -p -r1.6 rebaseimage.cc
--- imagehelper/rebaseimage.cc  30 Apr 2012 13:37:16 -  1.6
+++ imagehelper/rebaseimage.cc  15 Jan 2013 12:35:45 -
@@ -118,7 +118,7 @@ BOOL ReBaseImage64 (
   ntheader32->FileHeader.TimeDateStamp = TimeStamp;
 }
 
-  int difference = *NewImageBase - *OldImageBase;
+  int64_t difference = *NewImageBase - *OldImageBase;
 
   if (!dll.performRelocation(difference))
 {
Index: imagehelper/sections.cc
===
RCS file: 
/sourceware/projects/cygwin-apps-home/cvsfiles/rebase/imagehelper/sections.cc,v
retrieving revision 1.4
diff -u -p -r1.4 sections.cc
--- imagehelper/sections.cc 8 Jul 2011 07:18:55 -   1.4
+++ imagehelper/sections.cc 15 Jan 2013 12:35:45 -
@@ -302,14 +302,15 @@ bool Relocations::check(void)
   int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) 
/ sizeof (WORD);
   int va = relocp->VirtualAddress;
   PWORD p = (PWORD)((uintptr_t)relocp + sizeof(IMAGE_BASE_RELOCATION));
-   if (debug)
-   std::cerr << "debug: blocksize= " << std::dec << NumOfRelocs << 
std::endl;
+  if (debug)
+ std::cerr << "debug: blocksize= " << std::dec << NumOfRelocs << 
std::endl;
 
   cursec = sections->find(va);
-   if (debug) {
-   std::cerr << "debug: section= "; 
-   cursec->debugprint();
-  }
+  if (debug)
+{
+ std::cerr << "debug: section= "; 
+ cursec->debugprint();
+   }
   if (!cursec)
 {
   if (debug)
@@ -319,11 +320,12 @@ bool Relocations::check(void)
   errors++;
   continue;
 }
-   for (int i = 0; i < NumOfRelocs; i++,p++) {
-   int location = (*p & 0x0fff) + va;
- if (debug)
-   std::cerr << "debug: location= 0x" << std::setw(8) << 
std::setfill('0') << std::hex << location << std::endl;
- }
+  if (debug)
+   for (int i = 0; i < NumOfRelocs; i++,p++)
+ {
+   int location = (*p & 0x0fff) + va;
+   std::cerr << "debug: location= 0x" << std::setw(8) << 
std::setfill('0') << std::hex << location << std::endl;
+ }
 }
   return errors == 0;
 }
@@ -365,7 +367,7 @@ bool Relocations::fix(void)
 }
 
 
-bool Relocations::relocate(int difference)
+bool Relocations::relocate(int64_t difference)
 {
   PIMAGE_BASE_RELOCATION relocp = relocs;
   int WholeNumOfRelocs = 0;
@@ -386,8 +388,6 @@ bool Relocations::relocate(int differenc
 }
   WholeNumOfRelocs += NumOfRelocs;
 
-  int adjust;
-
   Section *cursec = sections->find(va);
   if (!cursec)
 {
@@ -398,29 +398,55 @@ bool Relocations::relocate(int differenc
return false;
 }
   else if (debug)
-// FIXME: this goes to cout but debug message should go to cerr
-  

Re: [ITA] postgresql-9.2.2-1

2013-01-15 Thread marco atzeri

On 1/15/2013 11:28 AM, Corinna Vinschen wrote:

On Jan 15 00:24, marco atzeri wrote:

On 1/14/2013 10:28 PM, Reini Urban wrote:

On Mon, Jan 14, 2013 at 12:40 AM, marco atzeri wrote:

wget -r -np -nH --cut-dirs=1 \
http://matzeri.altervista.org/cygwin-1.7/postgresql/index.html


/etc/rc.d/init.d/postgresql needs an +x,


added


and the .exe in DAEMON is wrong

ls -al /usr/sbin/postmaster
/usr/sbin/postmaster -> postgres.exe


What you mean, that postmaster need an exe as extention ?
It seems a fault of cygport post install that strip the .exe
from the  postmaster.exe link.


If that's unclear, symlinks should *not* use the .exe extension.


than is wrong in the current postgresql-8.2.11-1 packages ;-)

Wed Jan  7 16:50:24 20093051520 usr/sbin/postgres.exe
Wed Jan  7 16:48:15 2009  0 usr/sbin/postmaster.exe -> 
postgres.exe



but correct on 9.2.2-1
$ cygcheck -l postgresql |grep sbin
[cut]
/usr/sbin/postgres.exe
/usr/sbin/postmaster

due to cygport post install cleaning


Corinna


Regards
Marco





Re: [ITA] postgresql-9.2.2-1

2013-01-15 Thread Corinna Vinschen
On Jan 15 00:24, marco atzeri wrote:
> On 1/14/2013 10:28 PM, Reini Urban wrote:
> >On Mon, Jan 14, 2013 at 12:40 AM, marco atzeri wrote:
> >>wget -r -np -nH --cut-dirs=1 \
> >>http://matzeri.altervista.org/cygwin-1.7/postgresql/index.html
> >
> >/etc/rc.d/init.d/postgresql needs an +x,
> 
> added
> 
> >and the .exe in DAEMON is wrong
> >
> >ls -al /usr/sbin/postmaster
> >/usr/sbin/postmaster -> postgres.exe
> 
> What you mean, that postmaster need an exe as extention ?
> It seems a fault of cygport post install that strip the .exe
> from the  postmaster.exe link.

If that's unclear, symlinks should *not* use the .exe extension.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat


Re: [ITA] postgresql-9.2.2-1

2013-01-15 Thread marco atzeri

On 1/15/2013 12:24 AM, marco atzeri wrote:

On 1/14/2013 10:28 PM, Reini Urban wrote:

On Mon, Jan 14, 2013 at 12:40 AM, marco atzeri wrote:




/usr/lib/postgresql/dict_snowball.dll: fixing bad relocations
Segmentation fault (core dumped)


it seems that is not a contrib dll but a core function
when we solve the rebase issue I will move to right package

Not installing postgresql-contrib and skipping the dictionaries with

$ mv /usr/share/postgresql/snowball_create.sql 
/usr/share/postgresql/snowball_create.sql_bk

$ touch /usr/share/postgresql/snowball_create.sql



$ psql
Segmentation fault (core dumped)


$ psql
psql: could not connect to server: No such file or directory
 Is the server running locally and accepting
 connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

re-uploading just in case I uploaded the wrong build.


I am correctly able to initdb, createdb, run postgres ,
and connect with psql

$ psql
psql (9.2.2)
Type "help" for help.

marco=# quit
marco-# ^C
marco=# \q

Regards
Marco