Unexpected

Unexpected

Unexpected
作者提供的相关的附件(大小:47 K)

不好意思,本来是要贴在国外Perl论坛上,没时间再用中文写一遍(已经1:30了,累死了),希望好心人、耐心人能够帮忙看一下。

Hi, Perl gurus
I have a strange unexpected array reference modification problem when writing a batch cvs operation script. In short, this script read change list from a file. And parse it into a map with structure like below:
= 'biz/member';
= {
'main' => [
'src/java/com/alibaba/exodus2/biz/member/ao/MemberValidationAO.java'
]
};
= 'biz/product';
= {
'main' => [
'src/java/com/alibaba/exodus2/biz/product/ao/ProductDetailAO.java'
]
};
= 'common/config';
= {
'main' => [
'src/conf/exodus2/rewrite.xml',
'src/conf/exodus2/webservice.xml'
]
};
= 'biz/offer';
= {
'main' => [
''
]
};
= 'exodus2-deploy';
= {
'main' => [
'templates/member/screen'
]
};
then this map is passed two subroutine to read. So the map should remain unchange after invocation of the two subroutine. But something unexpected happened. After calling the second subroutine(checkConflictResolved() in cvs-ci.pl), the array reference changed to undef. There is no modification made to this map in the second subroutine. But it open a lot files to examine if they have cvs conflict unresolved. Maybe these checks require too much memory so that memory used by may is robbed?

Attached is the complete Perl source code and data file to reproduce this problem.
You need to install XML::parser module and put gb2312.enc to Encodings sub directory of this module. If you run Perl under MS Windows, set environment variable PERL5LIB to directory contains the attached cvs-common.pl.
You can type cvs-ci.pl -f filelist3.txt and get:

After step 1 -- checkUpToDate:
= 'biz/member';
= {
'main' => [
'src/java/com/alibaba/exodus2/biz/member/ao/MemberValidationAO.java'
]
};
= 'biz/product';
= {
'main' => [
'src/java/com/alibaba/exodus2/biz/product/ao/ProductDetailAO.java'
]
};
= 'common/config';
= {
'main' => [
'src/conf/exodus2/rewrite.xml',
'src/conf/exodus2/webservice.xml'
]
};
= 'biz/offer';
= {
'main' => [
''
]
};
= 'exodus2-deploy';
= {
'main' => [
'templates/member/screen'
]
};

After step 2 -- checkConflictResolved:
= 'biz/member';
= {
'main' => [
undef
]
};
= 'biz/product';
= {
'main' => [
undef
]
};
= 'common/config';
= {
'main' => [
undef,
undef
]
};
= 'biz/offer';
= {
'main' => [
''
]
};
= 'exodus2-deploy';
= {
'main' => [
'templates/member/screen'
]
};


Total time: 7 seconds

Perl version I used is v 5.8.4 activestate distribution.
Could anybody know why it doesn't work? Pls help me figure out the root cause of this problem. Thank you very much!

Rgds,
Justin




   

变通的方法已找到
这个问题一直存在。我想了个变通的方法,在调用那个引起错误的子例程之前做一个对原来的map的备份,方法调用完成后恢复这个备份即可绕过这个问题。
autorun ?
autorun肯定不行,右键就可以跳过啊
晕。这和 Perl 有一毛钱的关系没。
先研究研究操作系统吧。
我是不会,太高深了。
不过我知道修改硬盘裸设备可以把硬盘上的数据搞坏,
不知道这个思路可不可以。
这个Perl做不好。
你需要Hook windows api,判断用户打开分区的行为。
当打开对应分区时,弹出认证窗口。
用C或者ASM做。
这个有意思,但我怎么觉得不太可能呢?应该跟操作系统有关吧。
这有什么不可能的。
windows Hook 一下ssdt,linux hook一下system call就可以了。
能详细说下么?
是啊,具体说一下